write a program to splitting a string into separate string based on a delimiter character.
for example: suppose you have a string with the parts of an address separated by colons, like this:
591.TS/2/11 Third Street: in: Kedah: 06000.
with the split method, you can easily separate this string into four string. in the process, the colons are discard.
splitting a string into separate strings
Page 1 of 12 Replies - 999 Views - Last Post: 19 October 2011 - 11:25 AM
Replies To: splitting a string into separate strings
#2
Re: splitting a string into separate strings
Posted 19 October 2011 - 11:20 AM
#3
Re: splitting a string into separate strings
Posted 19 October 2011 - 11:25 AM
Try:
<code>StringTonizer st = new StringTokenizer( yourString, ": ");
String firstString = st.nextToken();</code>
Try:
<code>StringTonizer st = new StringTokenizer( yourString, ": ");
String firstString = st.nextToken();</code>
oops... I mean:
<code>StringTonizer st = new StringTokenizer( yourString, ": ");
String firstString = st.nextToken();</code>
Try:
<code>StringTonizer st = new StringTokenizer( yourString, ": ");
String firstString = st.nextToken();</code>
oops... I mean:
StringTonizer st = new StringTokenizer( yourString, ": "); String firstString = st.nextToken();
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|