with full case folding compare, similar to CompareMemoryString
in place string case mappings for uppercase lowercase and titlecase
string replacements for left, mid, right, len, ucase, lcase, asc, chr
additional tcase (title case)
Strip accents
The data supports both implementations that require simple case foldings
(where string lengths don't change), and implementations that allow full case folding
(where string lengths may grow). Note that where they can be supported, the
full case foldings are superior: for example, they allow "MASSE" and "Maße" to match.
;UTF16 v 2.0.0
;Authors idle mk-soft 15/11/22 - 10/5/23
;license MIT
;
;fullcase folding is required when a strings length differs but is deemed equivalent
;see https://www.unicode.org/Public/UCD/late ... olding.txt
;for example "mASSE" and "Maße" are equal.
;this provides a fast scalable string compare
;casemappings
;see "http://www.unicode.org/Public/UCD/lates ... deData.txt"
;
;#CaseNormal s <> S
;#CaseSimple s = S
;#CaseFull ss = ß
;History
;v1.2.1
;redone in table, needs improvment
;added normal strcmp for completeness
;v1.2.2
;fixed stride bug if size of mapped char > $FFFFFF + 3 to other string
;v1.2.3
;swapped around mapping was in reverse order
;v1.2.4
;returns 1 if strings are equal
;v1.2.5 19/12/22
;changed flag to #CASEWITHCASE TO #CASENORMALL
;v1.2.6 Changed to support surrogate pairs for UTF16 support
; added chr_() asc_() functions for surrogate pairs
;v1.2.7 fixed bug in _asc function
;v1.2.8 fixed short string bug
;v1.2.9 fixec bug in same case mapping 1st char
;v1.2.10 fixed start of table
;v1.2.11 Added Left_, Right_, Len_, Is_UTF16 : mk-soft
;v1.2.12a Added Mid_. pUpCase, pLowCase : idle
;v1.2.13a Redid Casemapping data added pTitleCase : idle
;v2.0.0 Renamed module and it's functions as it's grown beyond casefolding
;v2.0.1 Redid strLcase strUcase removed redundant ifs, redid arrays for better cache locality. added speed test for strLcase strUcase : idle
Implementations v2
https://github.com/idle-PB/UTF16
Performance with c backend
UTF16 Strcmp(s3,s4) 68 ms for 1,000,000
PB CompareMemoryString(@s3,@s4) 62 ms for 1,000,000
UTF16 strLCase / strUcase 41 ms for 1,000,000
PB LCase / UCase 486 ms for 1,000,000
Note: If you need to support Turkish with full case folding use the StrcmpTK function.