Jump to content
We've recently updated our Privacy Statement, available here ×

Conversion from Integer to String


prabhudar

Recommended Posts

Hi,

I have one problem,  in our report development one requirement is like when loc_id is "" then print "N/A" else loc_id is having values like '002530' and need to printed like '2530' , I cant use substring as '002530'  can be '0002530' also so I want to convert this to integer and to display , I used new Integer(parseInt.(str)) but then it is giving me error can not cast string to integer , can you guide me on this ?

 

 

-Thanks & Regards

Darshan

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

new Integer(Integer.valueOf($F{loc_id}))

This should work, assuming your loc_id field is called $F{loc_id}.

To get the N/A thing working you could use this:

$F{loc_id} == "" ? new String("N/A") : new Integer(Integer.valueOf($F{loc_id}))

(i.e. if string = "" then print new String N/A, else print integer value of string)

 

Stefan

 



Post Edited by englbrechtful at 10/20/2009 13:00
Link to comment
Share on other sites

  • 5 years later...

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...