aspose file tools*
The moose likes Java in General and the fly likes Trimming multi-byte spaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Trimming multi-byte spaces" Watch "Trimming multi-byte spaces" New topic
Author

Trimming multi-byte spaces

Ved Antani
Greenhorn

Joined: Jan 05, 2003
Posts: 28
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

Joined: Mar 22, 2000
Posts: 12781
    
    5
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

Joined: Jan 05, 2003
Posts: 28
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

Joined: Jan 30, 2000
Posts: 18671
Try Character.isSpaceChar().


"I'm not back." - Bill Harding, Twister
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
This may be dumb, but doesn't trim() do the job? It should remove all "white space" in the current character set?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trimming multi-byte spaces