ascii: faster capitalize.

windows-drag
John Benediktsson 2019-03-21 20:11:46 -07:00
parent 4f401a1585
commit ebc1c1ef58
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ IN: ascii
[ [ 1 ] when-zero cut-slice swap ]
[ f 0 rot [ length ] keep <slice> ] if*
] produce nip ;
: capitalize ( str -- str' ) unclip [ >lower ] [ ch>upper ] bi* prefix ;
: capitalize ( str -- str' ) >lower 0 over [ ch>upper ] change-nth ;
: >title ( str -- title ) >words [ capitalize ] map concat ;
HINTS: >lower string ;