Documentation: Difference between revisions

Content added Content deleted
(Added Wren)
(→‎{{header|Wren}}: Changed method name for consistency with 'Fmt' module.)
Line 1,839: Line 1,839:


// capitalizes the first letter of an ASCII string
// capitalizes the first letter of an ASCII string
static toTitle(s) {
static capitalize(s) {
var firstByte = s[0].bytes[0]
var firstByte = s[0].bytes[0]
if (firstByte >= 97 && firstByte <= 122) {
if (firstByte >= 97 && firstByte <= 122) {
Line 1,851: Line 1,851:
// test code
// test code
var smol = "meaning of life"
var smol = "meaning of life"
System.print("'%(smol)' + 123 = %(add.call(mol, 123))")
System.print("'%(smol)' + 123 = %(add.call(mol, 123))")
System.print("'%(smol)' reversed = %(StrUtil.reverse(smol))")
System.print("'%(smol)' reversed = %(StrUtil.reverse(smol))")
System.print("'%(smol)' titled = %(StrUtil.toTitle(smol))")</lang>
System.print("'%(smol)' capitalized = %(StrUtil.capitalize(smol))")</lang>


{{out}}
{{out}}
<pre>
<pre>
'meaning of life' + 123 = 165
'meaning of life' + 123 = 165
'meaning of life' reversed = efil fo gninaem
'meaning of life' reversed = efil fo gninaem
'meaning of life' titled = Meaning of life
'meaning of life' capitalized = Meaning of life
</pre>
</pre>



=={{header|ZX Spectrum Basic}}==
=={{header|ZX Spectrum Basic}}==