well this piece of code will work, but you should implement it with StringBuffer, not with String as String's are immutable and with every += you are allocating a new String and copying everything what can become a great overhead.
michael -----Original Message----- From: Chandramouli Nagarajan [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 11:26 AM To: '[EMAIL PROTECTED]' Subject: RE: Handling apostrophes Not really a big overhead, this piece of code wld do that... public String padApos(String toPad) { StringTokenizer tokenizer=new StringTokenizer(toPad,"'"); String retVal=new String(""); while(tokenizer.hasMoreTokens()) { retVal+=tokenizer.nextToken()+"''"; } retVal=retVal.substring(0,retVal.length()-2); return retVal; }
