i have a project in java1.4 where i am tring to insert a string in method with regular expression($) but it is giving me the error array index out of bound . can any one suggest me the method to convert that (string+regular expression) into (string) .
String s = obj.getString(); -- giving an error arrayindexoutofbound .
s="my data commissoned to $125";
Thanks and regards,
Ashutosh Singh Jadon|SCJP 6.0|
Ashutosh Singh Jadon
Greenhorn
Joined: Sep 14, 2011
Posts: 18
posted
0
Ashutosh Singh Jadon wrote:hi all,
i have a project in java1.4 where i am tring to insert a string in method with regular expression($) but it is giving me the error array index out of bound . can any one suggest me the method to convert that (string+regular expression) into (string) .
String s = obj.getString(); -- giving an error arrayindexoutofbound .
s="my data commissoned to $125";
String coming in this getter method is "my data commissoned to $125" and because of this $ sign it is giving the exception . is there any way to get this string as a string in java 1.4 .
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
The $ symbol has special meaning in regexps; you need to escape it via a single (or double, depending on context) backslash, like \$ or \\$.
Ashutosh Singh Jadon
Greenhorn
Joined: Sep 14, 2011
Posts: 18
posted
0
Thanks Tim , can we convert or nullify the regexps value in an string by any method in java1.4 because in java 1.5 there is quoteReplacement method .