Difference between revisions of "Code Snippet: Changing Character Case"
From Coder Merlin
NerdOfLinux (talk | contribs) |
Nerdofcode (talk | contribs) (Added lisp version of up/downcase) |
||
Line 13: | Line 13: | ||
print(string.upper()) | print(string.upper()) | ||
print(string.lower()) | print(string.lower()) | ||
</syntaxhighlight> | |||
== Common Lisp == | |||
<syntaxhighlight lang="lisp"> | |||
(let ((string "Hello, world!")) | |||
(write-line (string-upcase string)) | |||
(write-line (string-downcase string))) | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 16:04, 12 September 2019
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Print characters in uppercase or lowercase[edit]
Swift[edit]
let string = "For the world is hollow, and I have touched the sky!"
print(string.uppercased())
print(string.lowercased())
Python[edit]
string = "For the world is hollow, and I have touched the sky!"
print(string.upper())
print(string.lower())
Common Lisp[edit]
(let ((string "Hello, world!"))
(write-line (string-upcase string))
(write-line (string-downcase string)))