Jump to content

String case: Difference between revisions

Changed task description, modified all code examples to suit.
(Changed task description, modified all code examples to suit.)
Line 1:
{{task}}
 
Demonstrates how to convert a string to UPPER CASE.
Take the string "alphaBETA", and demonstrate how to convert it to UPPER-CASE and lower-case.
 
==[[Ada]]==
Line 18 ⟶ 19:
[[Category:Forth]]
 
create s ," abc123alphaBETA"
s count type \ shows: abc123alphaBETA
s count 2dup upper type \ shows: ABC123ALPHABETA
s count 2dup lower type \ shows: abc123alphabeta
 
==[[JavaScript]]==
[[Category:JavaScript]]
 
alert( "lower case textalphaBETA".toUpperCase() );
alert( "alphaBETA".toLowerCase() );
 
Output:
ALPHABETA
LOWER CASE TEXT
alphabeta
 
==[[Perl]]==
Line 35 ⟶ 38:
'''Interpreter:''' [[Perl]] v5.x
 
my $string = uc('string to uppercase')"alphaBETA";
my $uppercase = uc($string);
my $lowercase = lc($string);
 
 
==[[Python]]==
Line 41 ⟶ 47:
 
s = "alphaBETA"
print s.upper() #or s.lower()
print s.lower()
 
==[[SQL]]==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.