String case: Difference between revisions
Content added Content deleted
Line 26: | Line 26: | ||
[[Category:JavaScript]] |
[[Category:JavaScript]] |
||
alert( "lower case text".toUpperCase() ); |
|||
var s = "1234.56"; |
|||
var UPS = s.toUpperCase(); //or .toLowerCase() |
|||
Output: |
|||
alert(UPS); |
|||
LOWER CASE TEXT |
|||
//Or, to test in web browser URL: javascript:s="alphaBETA";alert(s.toUpperCase()) |
|||
==[[Perl]]== |
==[[Perl]]== |
Revision as of 21:06, 12 February 2007
String case
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Demonstrates how to convert a string to UPPER CASE.
Ada
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Text_Io; use Ada.Text_Io; procedure Upper_Case_String is S : String := "alphaBETA"; begin Put_Line(To_Upper(S)); Put_Line(To_Lower(S)); end Upper_Case_String;
Forth
create s ," abc123" s count type \ shows: abc123 s count 2dup upper type \ shows: ABC123 s count 2dup lower type \ shows: abc123
JavaScript
alert( "lower case text".toUpperCase() );
Output:
LOWER CASE TEXT
Perl
Interpreter: Perl v5.x
my $string = uc('string to uppercase');
Python
s = "alphaBETA" print s.upper() #or s.lower()
SQL
--tested in Microsoft SQL 2005 declare @s varchar(10) set @s = 'alphaBETA' print upper(@s) print lower(@s)