[futurebasic] Re: [FB] Re: LTRIM

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2001 : Group Archive : Group : All Groups

From: Osamu Shigematsu <shige@...>
Date: Fri, 19 Oct 2001 15:26:13 +0900
on 01.10.19 2:56 PM, Ken Shmidheiser at k.shmidheiser@... wrote:

> RUNTIME DEF TRUNCATE(@StrPtr&)
> '~'
> dim strLen
> strLen = peek(StrPtr&)
> while strLen > 0 and peek(StrPtr&+strLen) = _" "
> dec(strLen)
> WEND
> poke StrPtr&,strLen
> END FN

IMHO, TRUNCATE should be remove not only space, but also, tab, CR, LF and so
on, right?

And two or more bytes may express a blank character by some multi-byte
characters encoding system.

For example, in UTF8, one character needs a maximum of 6 bytes.
In UTF16, one character needs 2 bytes fundamentally. However, there is also
a character which needs 4 bytes.

Assuming that a character can be recorded in a byte means spoiling
possibilities.

-- 
Osamu Shigematsu

http://www.ravi.ne.jp/%7eshige/
mailto:shige@...