Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

iReport and using split array elements

 
Saul Davis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic