| Author |
populating a predefined list
|
Abagesh Kumar
Greenhorn
Joined: Mar 26, 2012
Posts: 9
|
|
For a string 0609|1|2834.56150|07710.32664|
I can parse using split .
Is it possible to have a predefined lsit or something which will hold
U1 = 1
L1 = 3
L3 = 2
L4 = 4
and will populate it with the exact values grabbing the substring from position( 1, 3, 2, 4).
U1 = 0609
L1 = 2834.56150
L3 = 1
L4 = 07710.32664
Any ideas on how to do this ?
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1776
|
|
The String class split() method returns you a String array. Suppose the array variable is str then you already have below values if you split using '|'.
You can store the combination as a combination int array ->
and print the str[combination]. Check with the array's length to avoid ArrayIndexOutOfBoundsException.
edit - by str[combination] I meant str[combination[0]], str[combination[1]],...
|
 |
Maganti Suryanarayana Murthy
Greenhorn
Joined: Apr 09, 2012
Posts: 10
|
|
I havenot got you what are U1, L1, L2 etc., Please be specific
|
Regards
Maganti Surya
|
 |
 |
|
|
subject: populating a predefined list
|
|
|