You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to do some string processing in a continuous way, e.g., java.lang.String(" some string").trim().replaceAll("regex", "replacement"), so that re module is not needed and code consistency with java side is better.
But I find that trim() returns unicode type, which result in an AttributeError: 'unicode' object has no attribute 'replaceAll' error.
To my understanding, Javatrim() returns java.lang.String type, so this should be the effort of automatic type conversion of java string to python unicode. Is it right?
If so, how to disable automatic type conversion in this situation? Or if not, is there another way to do so?
The text was updated successfully, but these errors were encountered:
There appears to be a bug in version 0.6.2. There is supposed to be an option that allows you to select if you want conversion or not. However, no mater which way I tried the switch it gives a buggy behavior.
Unfortunately JString is only useful to pass to a java method and doesn't have any String methods exposed.
Thus the best I can recommend is either use another string cast to put the wrapper back as a string f=String(String('foobar').trim()).replaceAll('bar','foo') or use the devel branch which we will release as 0.7.0 shortly.
Thrameos
added
the
bug
Unable to deliver desired behavior (crash, fail, untested)
label
Nov 6, 2018
I would like to do some string processing in a continuous way, e.g.,
java.lang.String(" some string").trim().replaceAll("regex", "replacement")
, so thatre
module is not needed and code consistency with java side is better.But I find that
trim()
returns unicode type, which result in anAttributeError: 'unicode' object has no attribute 'replaceAll'
error.To my understanding, Java
trim()
returnsjava.lang.String
type, so this should be the effort of automatic type conversion of java string to python unicode. Is it right?If so, how to disable automatic type conversion in this situation? Or if not, is there another way to do so?
The text was updated successfully, but these errors were encountered: