-
Posted by jitter on Sun, 08 May 2011 16:07:33
Hi,
I'm having a weird issue with the UTF-8 aware strsub function, taken from here:
When using the function like this (notice the "2"):
utf8sub(arg1,2,strlenutf8(arg1))
=>?dy
The function produses an incorrect string (just like the normal strsub). Where arg1 is a string with a special character as the first char, e.g. "Æddy". And the "?" is some invalid char.
But using the function with a strupper or strlower produces the correct result:
strlower(utf8sub(arg1,2,strlenutf8(arg1)))
=>ddy
When using the same function like this (notice the "1"):
utf8sub(arg1,1,1)
=>Æ
It produces the correct result again. I can not seem to find an explanation for this.
-
Posted by jnwhiteh on Sun, 08 May 2011 18:59:23
The start argument was 'startIndex' not 'startChar', which obviously isn't very useful. I've updated the example to allows it to function properly.
-
Posted by jitter on Sun, 08 May 2011 21:03:07
Thanks for your response. Will test it.