ruby gsub function in java, replaceAll maybe? -
i've been trying translate this
funcformat = funcformat.gsub(/sqrt\((.*)\)/,'math.sqrt(\1)') to in java
funcformat = funcformat.replaceall("sqrt((.*))","math.sqrt($1)"); or there way of formatting math text?, example :
2x^2sqrt(x^3/2) 2xpow2sqrt(xpow3/2)
thank you, , way i'm new in site.
you can use following expression:
funcformat = funcformat.replaceall("sqrt\\(([^)]*)\\)", "math.sqrt($1)"); although seems don't need regexes here. simple
funcformat = funcformat.replace("sqrt", "math.sqrt"); seems work situation.
Comments
Post a Comment