Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-12-2008, 03:09 PM
Member
 
Join Date: Aug 2008
Posts: 1
Rep Power: 0
santhoshrao is on a distinguished road
Thumbs up split Keyword
Hi All,
Is it possible to use the following syntax in java

text.split(".");

the code does not recognises (splits) by using the Dot

Regards
Santhosh rao
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 08-12-2008, 03:19 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Is there an escape char you can use?
YOU need to escape at two levels, once for the compiler and once for the regex.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-13-2008, 09:47 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,523
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
This is possible,

Code:
text.split("\\.");
As Norm says you have to deal with regular expressions as well.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-13-2008, 11:22 AM
Member
 
Join Date: Jul 2008
Posts: 35
Rep Power: 0
jack239 is on a distinguished road
Default
This applies to other symbols like ; or | if used in split() function.
__________________
New to Java/PHP/Javascript development?
For free help go to- www.techcubetalk.com
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-13-2008, 11:28 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,523
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Actually for any reg expression formatted well.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
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
problem with split method abhiN New To Java 7 02-10-2009 02:54 PM
How to split a String using split function Java Tip java.lang 1 08-26-2008 08:51 AM
how to split a file nagaraaju New To Java 0 03-14-2008 09:45 AM
How to split a String using split function JavaBean Java Tips 0 10-04-2007 10:32 PM
PDF Split and Merge 0.7 beta 1 JavaBean Java Announcements 0 06-24-2007 09:46 AM


All times are GMT +2. The time now is 05:16 AM.



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