String case: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 23: Line 23:
//Or, to test in web browser URL: javascript:s="alphaBETA";alert(s.toUpperCase())
//Or, to test in web browser URL: javascript:s="alphaBETA";alert(s.toUpperCase())

==[[Perl]]==
[[Category:Perl]]
'''Interpreter:''' [[Perl]] v5.x


==[[Python]]==
==[[Python]]==

Revision as of 16:44, 12 February 2007

Task
String case
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;

JavaScript

var s = "1234.56";
var UPS = s.toUpperCase(); //or .toLowerCase()
alert(UPS);

//Or, to test in web browser URL: javascript:s="alphaBETA";alert(s.toUpperCase())

Perl

Interpreter: Perl v5.x

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)