factor/extra/strings/lib/lib.factor

15 lines
351 B
Factor
Raw Normal View History

2008-01-16 15:20:28 -05:00
USING: math arrays sequences kernel splitting strings ;
2007-09-20 18:09:08 -04:00
IN: strings.lib
! : char>digit ( c -- i ) 48 - ;
2007-09-20 18:09:08 -04:00
! : string>digits ( s -- seq ) [ char>digit ] { } map-as ;
2008-01-16 15:20:28 -05:00
! : >Upper ( str -- str )
! dup empty? [
! unclip ch>upper 1string swap append
! ] unless ;
2008-01-16 15:20:28 -05:00
! : >Upper-dashes ( str -- str )
! "-" split [ >Upper ] map "-" join ;