This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes iReport and using split array elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "iReport and using split array elements" Watch "iReport and using split array elements" New topic
Author

iReport and using split array elements

Saul Davis
Greenhorn

Joined: Jul 06, 2010
Posts: 3
This is more of a general java question, but I'm using it within iReport.

How can I get the element of an array that contains items from the split() method; in one line?

So i need to:
split a CSV string
get a specific element from the array that the split command will return

-- all in one line since iReport is limited to one line expressions

pseudojava: (split({"element 1","element 3","element 4"}, "")).get(0)

Thanks in advance, I just can't seem to figure it out.
Saul Davis
Greenhorn

Joined: Jul 06, 2010
Posts: 3
Well this isn't a very good thread, of course after posting... I figured it out!


new String("102,545,365").split(",")[0]

which returns: 102
 
 
subject: iReport and using split array elements