add >Upper, >Upper-dashes

db4
Doug Coleman 2008-01-16 10:20:28 -10:00
parent 93187f356b
commit 40df3eefc3
1 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,14 @@
USING: math arrays sequences ;
USING: math arrays sequences kernel splitting strings ;
IN: strings.lib
: char>digit ( c -- i ) 48 - ;
: string>digits ( s -- seq ) [ char>digit ] { } map-as ;
: >Upper ( str -- str )
dup empty? [
unclip ch>upper 1string swap append
] unless ;
: >Upper-dashes ( str -- str )
"-" split [ >Upper ] map "-" join ;