• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trimming multi-byte spaces

 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to write a simple function that can trim any (Any languagei.e., japanese, chinese ...etc) multibyte spaces....I want a generic method for this

Please help me !!!

Ved
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to determine whether or not a Unicode character is a "space" - look at the java.lang.Character static isWhitespace( char ch ) method.
Bill
 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I tried that but isWhitespace() does not recognize spaces which are multibyte( like in japanese langauge, Hiragana or Katakana characters are of 2 bytes and spaces are also of two bytes)

so it fails in telling me whether that character is a space or not...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Character.isSpaceChar().
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may be dumb, but doesn't trim() do the job? It should remove all "white space" in the current character set?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic