| Author |
Split function of String class
|
Sim Kim
Ranch Hand
Joined: Aug 06, 2004
Posts: 268
|
|
Hi All, I am trying to use Split function of String class . But it does not seem to work fine . Example : "Hello@Hi@Bye".split("@") : Works fine but : "Hello|Hi|Bye".split("|") : Does not works as intended . Can somebody tell me why delimiter character "|" cannot be used ?
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
|
"|" is a special character in regular expressions. You need to escape it
|
Joanne
|
 |
Sim Kim
Ranch Hand
Joined: Aug 06, 2004
Posts: 268
|
|
|
Which all are the special characters . I guess "|" and "*" . Are there any more ?
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
[ \ ^ $ . | ? * + ( )
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
|
See the doc for Pattern. You can make some pretty fancy delimiters!
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
|
|
subject: Split function of String class
|
|
|