]> gitweb.factorcode.org Git - factor.git/blob - extra/strings/lib/lib.factor
Lot's of USING: fixes for ascii or unicode
[factor.git] / extra / strings / lib / lib.factor
1 USING: math arrays sequences kernel splitting strings ;
2 IN: strings.lib
3
4 ! : char>digit ( c -- i ) 48 - ;
5
6 ! : string>digits ( s -- seq ) [ char>digit ] { } map-as ;
7
8 ! : >Upper ( str -- str )
9 !     dup empty? [
10 !         unclip ch>upper 1string swap append
11 !     ] unless ;
12
13 ! : >Upper-dashes ( str -- str )
14 !     "-" split [ >Upper ] map "-" join ;