the split method you use on a string. For example you capture into a
variable (string type)- value "Adam Smith"

String myStrng ="Adam Smith";
however you want to separate it and to have in one variable "Adam" and
in the other variable "Smith"

in order to do it :

String names[]=myString.split(" ");

so you do split on a String and in the brackets you specify what is
the place of the separation- in this case it is a space " ". The
method returns an array, that is why you put it in an array

names[0]  will store Adam
names[1] will store Smith

in this specific case

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to