From: Hongda Cheng@MITEL on 07/19/2001 01:11 PM
Hi Schmitz,
You probably got to awrong discussion group with this issue.
Anyway, java.lang.StringBuffer, java.util.StringTokenizer and java.util.String
have enough methods to do so.
For instance, assume your original String is ori_str = "some_prefix ...
whatever ... some postfix"
You could have following code
java.util.StringTokenizer st = new StringTokenizer(ori_str, "whatever") ;
String new_str = "";
String WHITE_SPACE = " ";
String new_str_segment = "some new seg";
while(st.hasMoreTokens()){
String p = st.nextToken();
new_str += p.equals("whatever") ? new_str_segment : p;
new_str +=WHITE_SPACE;
}
StringBuffer.replace(int start, int end, String str) could do the same job
I didnt run above piece. But the idea is there.
Good luck.
Hongda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists