File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populating a predefined list

 
Abagesh Kumar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
Eclipse IDE Hibernate Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I havenot got you what are U1, L1, L2 etc., Please be specific

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic