Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help understanding unicode and findrx
#2
Good model.
To generate character offsets:
Function StrLenToCharCount
Code:
Copy      Help
;/
function# $s nBytes

;Converts byte count to character count in string.
;Returns the number of characters that corresponds to nBytes.

;s - string.
;nBytes - can be string length or some offset in string, in bytes.
;;;If -1, this function calls len() to get string length.

;REMARKS
;In Unicode mode, non-ASCII characters consist of more than 1 byte.
;len() and other QM string functions always use byte count.


opt noerrorshere 1
if(nBytes<0) nBytes=len(s)
if(!_unicode) ret nBytes
ret MultiByteToWideChar(_unicode 0 s nBytes 0 0)
Macro Macro2347
Code:
Copy      Help
str s="ąbcž"
out s.len
out StrLenToCharCount(s s.len)
Macro Macro2348
Code:
Copy      Help
SendMessageW hwndre EM_SETSEL StrLenToCharCount(windowContents a[0 i].cpMin) StrLenToCharCount(windowContents a[0 i].cpMax)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)