Difference between revisions of "To upper case"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{ #vardefine:name|to_upper_case}}{{ #vardefine:return_type|string}}{{ FunctionPage| name={{#var:name}}| function_category=String Handling Routines| function1={{Function| name=…')
 
imported>Bale
m
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=String Handling Routines|
 
  
 
function1={{Function|
 
function1={{Function|
Line 16: Line 15:
 
}}|
 
}}|
  
function_description=Converts all lower-case alphabetic characters (a-z) found in {{pspan|text}} to their upper-case equivalents (A-Z) and returns the resulting string.|
+
function_description=Converts all lower-case alphabetic characters (a-z) found in {{pspan|text}} to their upper-case equivalents (A-Z) and returns the resulting string. Characters with diacritic marks such as ñ and á will also be converted to upper-case letters such as Ñ and Á.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|
Line 24: Line 23:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
string s = "hi i am a nigerian prince, would you like 1 million us dollar?";
 
string s = "hi i am a nigerian prince, would you like 1 million us dollar?";
s = to_lower_case(s);
+
s = to_upper_case(s);
 
print(s);
 
print(s);
 
</syntaxhighlight>|
 
</syntaxhighlight>|
Line 33: Line 32:
 
see_also={{SeeAlso|to_lower_case}}|
 
see_also={{SeeAlso|to_lower_case}}|
 
}}
 
}}
{{RFI|Does this have any effect on accented / tilded characters?}}
+
 
 +
[[Category:String Handling Routines]]

Latest revision as of 05:08, 22 May 2010

Function Syntax

string to_upper_case(string text )

  • text is the original string

Converts all lower-case alphabetic characters (a-z) found in text to their upper-case equivalents (A-Z) and returns the resulting string. Characters with diacritic marks such as ñ and á will also be converted to upper-case letters such as Ñ and Á.

Code Sample

Turns "normal" text into "loud" text.

string s = "hi i am a nigerian prince, would you like 1 million us dollar?";
s = to_upper_case(s);
print(s);

Returns:

HI I AM A NIGERIAN PRINCE, WOULD YOU LIKE 1 MILLION US DOLLAR?

See Also

to_lower_case()