Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex ucase replacement
#2
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
Code:
Copy      Help
;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


Messages In This Thread
Regex ucase replacement - by TheVig - 11-11-2021, 02:50 PM
RE: Regex ucase replacement - by Gintaras - 11-11-2021, 08:32 PM
RE: Regex ucase replacement - by TheVig - 11-12-2021, 09:57 PM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 12:56 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 01:08 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 02:54 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 03:25 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 03:37 AM
RE: Regex ucase replacement - by Kevin - 09-11-2022, 03:44 AM
RE: Regex ucase replacement - by Robw92 - 09-11-2022, 03:56 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)