cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert interger to string

Former Member
0 Kudos

Hi All,

How do I convert Integer to String?

XIer

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Hi,

the easiest way is

String test =""IntegerValue"";

If you don't like the above way then follow the below ways.

int <b>abc</b>= 90045;

String test = Integer.toString(<b>abc</b>);

String test1 = String.valueOf(<b>abc</b>);

Best regards,

raj.

Former Member
0 Kudos

Hi raj

I used the String test = integer.toString(test) function

but if i give the input value 1234 then i want the out put as 12.34

but its giving me the output 12

justin_santhanam
Active Contributor
0 Kudos

Venkatesh,

What input u gave in the integer varible , and wht u expect in string?

Best regards,

raj.

Former Member
0 Kudos

I have 12.34 in int, I want it in string.

Xier

Former Member
0 Kudos

Integer's does not have decimal values, you should use float instead of int to convert it to a string.

Former Member
0 Kudos

How come integer can have decimal values ?

You need to declare av variable of typoe dec or double rather than int.

Int cannot hold dec places hence it is just transferring 12. ( Becuase it hold 12 not 12.34)

Nilesh

Former Member
0 Kudos

Xler

I am sure you have not used int to store 12.24. You have probably used a float.

In any case tring to see what the input is before you call the function and after you the function..

You can use the abstract trace function -

AbstractTrace t1;

t1 = container.getTrace();

// before u call the function

t1.addInfo("" + yourVariable);

call function

t1.addInfo(""+ yourTransformedVariable);

Answers (2)

Answers (2)

Former Member
0 Kudos

XIer, could you explain more of the whole situation of what you're trying to do here, I think it might give me a better understanding of what is going on.

Like where is this int coming from, and what you're actually trying to send it to.

oh, nevermind, it's answered now.

Message was edited by:

Paul Reimius Schroeder

Former Member
0 Kudos

iVal.toString();