Jump to content

SPLIT METHOD


asterixx82

Recommended Posts

Hi guys,

the method "split " in iReport exist?

I try  this.

MyData=1547,98

MyData.toString().length()--------------> OK   = 7
(MyData.toString().split(",")[0]).lenght()--------->   NOT OK   = " 7 "
(MyData.toString().split(",")[1]).lenght()--------->   NOT OK   ERROR MESSAGE THAT  "ARRAY  INDEX......."

 

I hope that result   was = "4"

 

Bye

Thanks

 

 

Code:
($F{IMPSTRAOR}!=null)?Character.toString(("         "+$F{IMPSTRAOR}.toString()+"  ").substring((($F{IMPSTRAOR}.toString().split(",",2))[0]).length()).charAt(8)):""
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

the correct question is

"the method "split " in JAVA exist?"

 

use this:

MyData.substring(0,MyData.indexOf(',')).length()

 

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening:  Underworld - Beautiful Burnout (Mark Knight remix)

Link to comment
Share on other sites

sei italiano... :) ciao!

the split method works fine if you use it properly! :)

try this:

MyData.split("\\.")[0].length()

the argument of split method is a regular expression...
MyData.toString return a string rapresentation of the BigDecimal with '.' decimal separator, so you must use the regex '\\."

ricordati i punti karma! :)

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening:  CSI - Io Sto Bene

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...