Re: [Jython-users] Concating string and number..
by Jim Adrig other posts by this author
Oct 14 2003 7:49AM messages near this date
[Jython-users] Concating string and number..
|
Re: [Jython-users] Concating string and number..
Numeric -> String conversion is done with the BACK-quote character=20
`<num> `. So to concatenate:
s =3D 'test'
n =3D 123
c =3D s + `n`
This one got me too when I started using Jython.
Of course if you REALLY WANT to use Java, you could; for Integers:
from java.lang import Integer
c =3D s + Integer(a).toString()
Although if it might not be an Integer it would be harder.
Anyway, `` handles PyInteger and PyFloat.
Have fun !
- Jim
On Monday, October 13, 2003, at 10:40 PM, Vijay Mulimani wrote:
> Hi All,
> I have just started using Jython and do not have have a very deep=20
> knowledge about it. I am facing problem in concatenating a string=20
> value with a numeric value.
> Example-=A0 The string is stored in a variable, and there is another=20=
> variable which has a numeric value, I want to concatenate the string=20=
> and numeric value.
> I tried but it's not as same as in Java.
> Some might find this Q as=A0a very silly and basic !!! But help is=20
> appreciated.
> =A0
> Thanks in advance.
> =A0
> Vijay
Attachments:
unknown1
Thread:
Vijay Mulimani
Jim Adrig
Jingzhao Ou
patrickchamberlain
patrickchamberlain
|