Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unicode character length and moving text cursor
#1
Hi,

I want to move the text cursor before the first letter o, and the result of macro M1 execution is correct, the result of macro M2 execution is incorrect

In utf8 mode, a unicode character occupies 3 bytes. How do I determine it and move it correctly?

Or, I need to move a unicode character as the length of a letter

Thanks in advance for any suggestions and assistance
david


Macro M1
 
Code:
Copy      Help
_s="hello, world"
_i=find(_s "o")
_i=_s.len-_i

paste _s
'L (#_i) ;;OK

Macro M2
Code:
Copy      Help
_s="hello你好,世界world"
_i=find(_s "o")
_i=_s.len-_i

paste _s
'L (#_i) ;;NO


Messages In This Thread
Unicode character length and moving text cursor - by Davider - 03-29-2023, 11:20 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)