{newBie} Deleting special characters.
1 posts in topic
Flat View  Flat View

Posted By:   anand_reddy
Posted On:   Thursday, October 24, 2002 02:07 PM

Can someone point me to some sample code that does the following:
I have a text field that contains some horizontal tab and new line characters.
I want to delete all such characters from this field and save it back in its new form.

Thank You in advance for your help. Anand M

Re: {newBie} Deleting special characters.

Posted By:   Stephen_Ostermiller  
Posted On:   Friday, October 25, 2002 06:25 AM

Try something like this:

String text = field.getText();
StringBuffer sb = new StringBuffer(text.length());
for (int i=0; i char c = text.charAt(i);
switch (c) {
case '
': break;
case '
': break;
case 0x9 : break; // horizontal tab
default: sb.append(c); break;
About | Sitemap | Contact