> (setq str (dup " 00" 10))
" 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 31))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 32))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
			
			
				Hi,
I'm still on a previous version and there's no problem ...
newLISP v.10.6.2 32-bit on Win32 IPv4/6 UTF-8 libffi, options: newlisp -h
> (setq str (dup " 00" 32))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 52))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> 
Yours,
s.v.
			
			
			
				I am back from the future :) no problem there ?
> (setq str (dup " 00" 52))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
>
			
			
				
> (setq str (dup " 00" 8))
" 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 1))
" 00"
> (trim str)
""
> (setq str (dup " 00" 2))
" 00 00"
> (trim str)
""
> (setq str (dup " 00" 3))
" 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 4))
" 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 5))
" 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 6))
" 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 7))
" 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 8))
" 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 9))
" 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 10))
" 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 11))
" 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 12))
" 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 13))
" 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 14))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 15))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 16))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 17))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 18))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 19))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 20))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0"
> (trim str)
""
> (setq str (dup " 00" 21))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00"
> (trim str)
""
> (setq str (dup " 00" 22))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00"
> (trim str)
""
> (setq str (dup " 00" 23))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 24))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 25))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 26))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 27))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 28))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 29))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 30))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 31))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 32))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 33))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 8))
" 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 1))
" 00"
> (trim str)
""
> (setq str (dup " 00" 2))
" 00 00"
> (trim str)
""
> (setq str (dup " 00" 3))
" 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 4))
" 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 5))
" 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 6))
" 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 7))
" 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 8))
" 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 9))
" 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 10))
" 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 11))
" 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 12))
" 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 13))
" 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 14))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 15))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 16))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 17))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 18))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 19))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 20))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0"
> (trim str)
""
> (setq str (dup " 00" 21))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00"
> (trim str)
""
> (setq str (dup " 00" 22))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00"
> (trim str)
""
> (setq str (dup " 00" 23))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00"
> (trim str)
""
> (setq str (dup " 00" 24))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 25))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 26))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 27))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 28))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 29))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 30))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 31))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 32))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 33))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 34))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 35))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 36))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 37))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 38))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 39))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> (trim str)
ERR: not enough memory in function trim
> (setq str (dup " 00" 40))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0"
> (trim str)
""
> (setq str (dup " 00" 41))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00"
> (trim str)
""
> (setq str (dup " 00" 42))
" 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00"
> (trim str)
""
			
			
				newLISP v.10.7.3
newLISP v.10.7.1
newLISP v.10.7.0
All have this issues.
Usually starting from 8, 16, 24, 32...., depending on the version.
But newLISP v.10.6.2,I tested from 1 to 65536, everything was fine.
			
			
			
				Hello,
trim seems not to like the null-character.
So is it valid whitespace character?
newLISP v.10.7.2 32-bit on Windows IPv4/6 libffi, options: newlisp -h
> (setq str "t 00   t")
"t 00   t"
> (trim str)
ERR: not enough memory in function trim
> (setq str "tabc 00   abct")
"tabc 00   abct"
> (trim str)
"abc 00   abc"
>
Regards
			
			
			
				'trim' was overrunning memory when all characters in string < 32 (space). 
Fixed here: 
http://newlisp.nfshost.com/downloads/development/inprogress/
			
			
			
				Hello Lutz,
Thanks for the fix.
Will characters <32 now handled as whitespace and get trimmed?
Or do they stay?
Regards
			
			
			
				See last paragraph here: 
http://www.newlisp.org/downloads/development/inprogress/CHANGES-10.7.3.txt
So the 10.7.3 now is more forgiving when a string contains zero characters, which it should'nt in perfect ASCII or UTF-8 where the zero character marks the end of the string.
			
			
			
				
			
			
				It occurs to me, if I was trimming a string, and it had  00 characters on either the left or the right side, I'd want them GONE.  If it is a binary string where the  00 character belongs, then I wouldn't be running trim on it, since trim is a textual function.
			
			
			
				Technically, since neither "xbbxe1" nor "xcexaaxcaxb2xc3xb4xbbxe1" are valid UTF-8 strings, the trim behaviour is conveniently undefined. It appears the