Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get len from string containing extended ASCII characters
#1
Sorry for this stupid question but below I have 7 characters in _s from the extended ASCII table found in [ALT]+196
But _s.len gives an incorrect value. I always used this to get the amount of characters but maybe I used incorrect method?

_s="───────" ;; Extended ASCII character ---> https://www.asciitable.com/ --> ALT 196

_s.len does not return 7, it returns 21
#2
_s="───────"
str s.format("[45%C]" _s)
out s.len
#3
_s.len gets length in bytes, not characters. Character '─' is 3 bytes. If need length in characters, the easiest but not fastest way is to convert the string to UTF-16.

Code:
Copy      Help
_s="───────"
out _s.len
BSTR b=_s
out b.len
#4
Thank you!  (also @redbull2k )!


Forum Jump:


Users browsing this thread: 2 Guest(s)