Problem trimming Japanese string in java -


I have the following string (Japanese) "ユ ー ザ ー 名", the first letter is like "whitespace" but unicode Its number is 12288, so if I do "ユ ー ザ ー 名". Team () I get a single string (trim does not work). If I trim in C ++ then it works fine. Does anyone know how to solve this issue in java? Is there a special trim method for Unicode?

as an alternative to stringing attributes> class described by Mike, you only have Java You can also use a unicode-aware regular expression using your library of:

  "ユ ー ザ ー 名" .replaceAll ("\\ p {Z}", "" )  

Or, actually trim only, and do not delete the white space inside the string:

  "ユ ー ザ ー 名" .replaceAll ("(^ \ P {Z} + | \\ p {Z} + $)", "")  

Comments