Get your CodeRanch badge!*
The moose likes Beginning Java and the fly likes Using split method with String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using split method with String " Watch "Using split method with String " New topic

Using split method with String

Moniphal Say
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
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 "" , I want to split into , "hello" and "java"

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

The string havent split !!


<b>The more we learn, the more we know !</b>
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

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:

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Moniphal Say
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Ok, it works with "\\." ,thanks

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Using split method with String
Similar Threads
converting string array to string
Split String by $
replace String input with parenthesis
String input with parenthesis