From: Oti <oh...@ya...> - 2002-10-28 05:50:10
|
[ Samuele Pedroni ] > > > > We are writing JUnit tests in Jython. If a method returns a byte or > > char array, it is convenient to use a java.lang.String constructor > and > > then use string.find() or similar to inspect it. > > > > And it is from time to time confusing for users (including me:-) to > > have the same 'string handling' code running for the result of a > java > > method returning java.lang.String, but failing for a just > instantiated > > java.lang.String > > > > if I understand correctly you have a method returning byte/char > arrays: > > obj.meth() > > and you do > > s = java.lang.String(obj.meth()) exactly. > You could use tostring (the jython char/byte array wrapper method): > > ar = obj.method() > s = ar.tostring() # produces a Python string yes, this works. Thanks ! Oti. __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ |