Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-28-2008, 10:02 PM
Member
 
Join Date: May 2008
Posts: 9
Rep Power: 0
Hayzam is on a distinguished road
Default deleting characters from a String
if i have String S which contains a mix of numbers , spaces , lower case and higher case characters ...

how can i delete the numbers and higher case characters , leaving spaces and lower case chars . ?!
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 08-28-2008, 11:12 PM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 289
Rep Power: 3
roots is on a distinguished road
Default
Code:
str = str.replaceAll("[A-Z]", "").replaceAll("[0-9]", "");
__________________
dont worry newbie, we got you covered.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-28-2008, 11:21 PM
Member
 
Join Date: May 2008
Posts: 9
Rep Power: 0
Hayzam is on a distinguished road
Default
thanks alot , but what about the special characters like ; : / { } ....etc

how can i delete them ?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-29-2008, 01:12 PM
ProjectKaiser's Avatar
Member
 
Join Date: Aug 2008
Location: Saint-Petersburg, Russia
Posts: 66
Rep Power: 0
ProjectKaiser is on a distinguished road
Default
Code:
str = str.replaceAll("[0-9A-Z;:/{}]", "");
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-29-2008, 01:14 PM
ProjectKaiser's Avatar
Member
 
Join Date: Aug 2008
Location: Saint-Petersburg, Russia
Posts: 66
Rep Power: 0
ProjectKaiser is on a distinguished road
Default
See Pattern class documentation for regular expression syntax
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get the characters one by one from a String? Somitesh Chakraborty New To Java 3 08-20-2008 09:56 PM
Deleting from an object vitaminz New To Java 7 08-10-2008 04:56 AM
Deleting Contractions theonly New To Java 3 04-27-2008 08:44 PM
How to split a string into multiple lines of x characters each JackJ New To Java 3 12-17-2007 03:35 AM
Getting all characters in a String Alayna New To Java 2 05-20-2007 12:49 PM


All times are GMT +2. The time now is 01:34 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org