This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using split method with String

 
Moniphal Say
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

How to split a string by a delimiter "." cos normally with the regular expression , "." mean any character. So if I want to split string into part which separted by a "."

For example : with a string "hello.java" , I want to split into , "hello" and "java"


run >> java Test toto.java
The result is --> 0

The string havent split !!

Regards,
moni
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You escape regex special character with '\'. Of course, that character is also an escape character in Java, so you will probably have to escape it twice. Try:
 
Moniphal Say
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, it works with "\\." ,thanks

regards,
moni
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic