php-i18n Digest 19 Dec 2002 04:01:11 -0000 Issue 138
Topics (messages 378 through 378):
calculating line length of Japanese string
378 by: Jean-Christian Imbeault
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I need to format some PHP output so that text lines up properly in
columns. The input text is in Japanese.
However I can't seem to figure out correctly how long a line is so that
I can then pad it with the necessary number of spaces.
The problems seems to be because the input text contains both japanese
and ASCII characters, and the ASCII characters take up one space, while
the Kanji/kana take up two.
Is there any way for me to count how many "one-space" characters there
are in a string and how many "two space" characters there are? That way
I can figure out exactly how "long" a string is ...
Thanks!
Jc
--- End Message ---