11-11-2021, 08:32 PM
QM regex replacement does not support \u.
Could use callback, but problem with non-ASCII characters.
This function does not use regex.
Member function str.TitleCase
Could use callback, but problem with non-ASCII characters.
This function does not use regex.
Member function str.TitleCase
;Makes the first character of every word uppercase.
;As word separators recognizes only ASCII whitespace (space, tab, newlines).
;Supports all Unicode word characters.
;EXAMPLE
;str s="hello world ąčę"
;s.TitleCase
;out s ;;Hello World Ąčę
if(!this.len) ret
BSTR b=this
int i
for i 0 b.len
,if i=0 or b[i-1]<=32
,,if b[i]>='a'
,,,_i=b[i]
,,,b[i]=CharUpperW(+_i)
this=b