capitalize
textSummary
Convert text into a capitalized version.
Description
This is simplified by having the first character be an upper-case version, as well as any character following a whitespace character, and all other characters be in lower-case.
Arguments
text
The input string
Return value
Returns the capitalized version
Examples
(capitalize "Testing THE Capitalization!") "Testing The Capitalization!"
Bytecode
Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.
( 0 ($get/val 'buffer/allocate)) ( 2 ($get/val 'buffer/length)) ( 4 ($get/val 'text)) ( 6 ($apply 1)) ( 8 ($apply 1)) ( 10 ($det/val 'ret)) ( 12 ($drop)) ( 13 ($push/true)) ( 14 ($det/val 'caps?)) ( 16 ($drop)) ( 17 ($let)) ( 18 ($push/int/byte 0)) ( 20 ($det/val 'i)) ( 22 ($drop)) ( 23 ($push/nil)) ( 24 ($jmp* 63)) ( 27 ($drop)) ( 28 ($get/val 'buffer/set!)) ( 30 ($get/val 'ret)) ( 32 ($get/val 'i)) ( 34 ($get/val 'caps?)) ( 36 ($jf* 8)) ( 39 ($get/val 'upper-case-char)) ( 41 ($jmp* 5)) ( 44 ($get/val 'lower-case-char)) ( 46 ($get/val 'buffer/ref)) ( 48 ($get/val 'text)) ( 50 ($get/val 'i)) ( 52 ($apply 2)) ( 54 ($apply 1)) ( 56 ($apply 3)) ( 58 ($drop)) ( 59 ($get/val 'whitespace?)) ( 61 ($get/val 'buffer/ref)) ( 63 ($get/val 'text)) ( 65 ($get/val 'i)) ( 67 ($apply 2)) ( 69 ($apply 1)) ( 71 ($jf* 7)) ( 74 ($push/true)) ( 75 ($jmp* 4)) ( 78 ($push/false)) ( 79 ($set/val 'caps?)) ( 81 ($drop)) ( 82 ($get/val 'i)) ( 84 ($inc/int)) ( 85 ($set/val 'i)) ( 87 ($get/val 'i)) ( 89 ($get/val 'buffer/length)) ( 91 ($get/val 'text)) ( 93 ($apply 1)) ( 95 ($<)) ( 96 ($jt* -69)) ( 99 ($drop)) ( 100 ($get/val 'buffer->string)) ( 102 ($get/val 'ret)) ( 104 ($apply 1)) ( 106 ($closure/pop)) ( 107 ($ret))