Hi,
Have you heard of the Java StringTokenizer class ?
Its in the SDK.
Arash Partow
__________________________________________________
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net
: Hi,
: Assume that I have a String msg = "ABC:DEF:GHIJ:KLMN"; Now I need to parse this based on the delimiter (':' in this case). such a way that I store these values as name-value in a hashtable.
:
: I did write the code. But the hitch is at one last stage there is an excpetion when we are left with KLMN.
: I wrote the code in java as follows
:
: String concat = "ABC:DEF:GHIJ:KLMN:OPQ:RST";
: int length = concat.length();
: int j;
: for(; length > 0 ;)
: {
:
: j = concat.indexOf(':');
: String key = concat.substring(0, j);
: System.out.println("Key " + key);
: concat = concat.substring(j + 1, length);
: System.out.println("Concat " + concat);
: length = concat.length();
: System.out.println("length " + length);
: j = concat.indexOf(':');
: String value = concat.substring(0, j);
: System.out.println("Value " + value);
: concat = concat.substring(j + 1, length);
: System.out.println("Concat " + concat);
: length = concat.length();
: System.out.println("length " + length);
:
:
: }
: