-1

Possible Duplicate:
string split in java

I have a string:

"jack#james#joahn#logan#"

I know there is a method of the String class that can seperate it on the symbol #. So it will return to me

"jack" "james" "joahn" "logan"

What is the name of this method?

Community
  • 1
  • 1
jeff ranz
  • 45
  • 1
  • 1
  • 5
  • 10
    _split()_ is what you look for. google.com is what you should learn for. – Juvanis Jan 09 '13 at 20:28
  • Here is one suggestion, if you want to find out methods of a class you can browse javadoc for that class http://docs.oracle.com/javase/6/docs/api/java/lang/String.html – kosa Jan 09 '13 at 20:30
  • 1
    The whole list of methods inside the String class isn't so long you can't read it... – Denys Séguret Jan 09 '13 at 20:30

2 Answers2

4

This is String.split("#"). For example:

String s = "jack#james#joahn#logan#";
String parts[] = s.split("#");
Andremoniy
  • 32,711
  • 17
  • 122
  • 230
0

See the String.split method. Here is an example:

kosa
  • 64,776
  • 13
  • 121
  • 163
OldProgrammer
  • 11,263
  • 3
  • 25
  • 42