String case: Difference between revisions

Content added Content deleted
No edit summary
(→‎[[Toka]]: Updated to work with Toka R1)
Line 292: Line 292:
needs ctype
needs ctype
[ i 1- ] is I
[ i 1 - ] is i
[ count [ dup I + c@ toupper over I + c! ] +iterate ] is >upper
[ string.getLength 0 [ dup i + c@ toupper over i + c! ] countedLoop ] is string.toUpper
[ count [ dup I + c@ tolower over I + c! ] +iterate ] is >lower
[ string.getLength 0 [ dup i + c@ tolower over i + c! ] countedLoop ] is string.toLower
" heLlO wORld" >upper type cr
" heLlO wORld" string.toUpper type cr
" HeLlO wORld" >lower type cr
" HeLlO wORld" string.toLower type cr