unicode.case: slightly cleaner locale case handling.
parent
0b8aa8efe0
commit
d3fc7ef6c2
|
@ -17,10 +17,10 @@ SYMBOL: locale ! Just casing locale, or overall?
|
||||||
: replace ( old new str -- newstr )
|
: replace ( old new str -- newstr )
|
||||||
[ split-subseq ] dip join ; inline
|
[ split-subseq ] dip join ; inline
|
||||||
|
|
||||||
: i-dot? ( -- ? )
|
: i-dot? ( locale -- ? )
|
||||||
locale get { "tr" "az" } member? ;
|
{ "tr" "az" } member? ; inline
|
||||||
|
|
||||||
: lithuanian? ( -- ? ) locale get "lt" = ;
|
: lithuanian? ( locale -- ? ) "lt" = ; inline
|
||||||
|
|
||||||
: lithuanian>upper ( string -- lower )
|
: lithuanian>upper ( string -- lower )
|
||||||
"i\u000307" "i" replace
|
"i\u000307" "i" replace
|
||||||
|
@ -80,19 +80,26 @@ SYMBOL: locale ! Just casing locale, or overall?
|
||||||
[ char-quot call out push ] ?if
|
[ char-quot call out push ] ?if
|
||||||
] each out "" like ; inline
|
] each out "" like ; inline
|
||||||
|
|
||||||
|
: locale>lower ( string -- string' )
|
||||||
|
locale get
|
||||||
|
[ i-dot? [ turk>lower ] when ]
|
||||||
|
[ lithuanian? [ lithuanian>lower ] when ] bi ;
|
||||||
|
|
||||||
|
: locale>upper ( string -- string' )
|
||||||
|
locale get
|
||||||
|
[ i-dot? [ turk>upper ] when ]
|
||||||
|
[ lithuanian? [ lithuanian>upper ] when ] bi ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: >lower ( string -- lower )
|
: >lower ( string -- lower )
|
||||||
i-dot? [ turk>lower ] when
|
locale>lower final-sigma
|
||||||
lithuanian? [ lithuanian>lower ] when
|
|
||||||
final-sigma
|
|
||||||
[ lower>> ] [ ch>lower ] map-case ;
|
[ lower>> ] [ ch>lower ] map-case ;
|
||||||
|
|
||||||
HINTS: >lower string ;
|
HINTS: >lower string ;
|
||||||
|
|
||||||
: >upper ( string -- upper )
|
: >upper ( string -- upper )
|
||||||
i-dot? [ turk>upper ] when
|
locale>upper
|
||||||
lithuanian? [ lithuanian>upper ] when
|
|
||||||
[ upper>> ] [ ch>upper ] map-case ;
|
[ upper>> ] [ ch>upper ] map-case ;
|
||||||
|
|
||||||
HINTS: >upper string ;
|
HINTS: >upper string ;
|
||||||
|
@ -100,8 +107,7 @@ HINTS: >upper string ;
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: (>title) ( string -- title )
|
: (>title) ( string -- title )
|
||||||
i-dot? [ turk>upper ] when
|
locale>upper
|
||||||
lithuanian? [ lithuanian>upper ] when
|
|
||||||
[ title>> ] [ ch>title ] map-case ; inline
|
[ title>> ] [ ch>title ] map-case ; inline
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
Loading…
Reference in New Issue