Difference between revisions of "Manual:DIL Manual/toupper()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = toupper() = | |
| + | '''Function''' (string). Returns a string in upper case. | ||
| − | + | toupper(s : string) | |
| − | + | Returns a copy of <code>s</code> with every small letter made a capital: | |
| − | + | <code>toupper("hello!")</code> is <code>"HELLO!"</code>. <code>s</code> itself is not changed. | |
| − | |||
| − | |||
| − | + | == Parameters == | |
| − | + | {| class="wikitable" | |
| − | + | ! Name !! Type !! Meaning | |
| + | |- | ||
| + | | s || string || The string. | ||
| + | |} | ||
| + | == Returns == | ||
| + | String: <code>s</code> in upper case; <code>""</code> for an empty string or one never set. | ||
| − | + | == Notes == | |
| − | + | * Only the letters a to z change; letters outside ASCII stay as they are. | |
| + | * To capitalise only the first letter, combine it with [[Manual:DIL Manual/left()|left()]] and | ||
| + | [[Manual:DIL Manual/right()|right()]] as in the example. | ||
| − | + | == Example == | |
| + | <pre> | ||
| + | dilbegin string capital(s : string); | ||
| + | code | ||
| + | { | ||
| + | return(toupper(left(s, 1)) + right(s, length(s) - 1)); | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | Returns the string with its first letter a capital, as helpzon.zon does with a help topic. | ||
| − | + | == See also == | |
| − | + | * [[Manual:DIL Manual/tolower()|tolower()]] | |
| − | + | * [[Manual:DIL Manual/left()|left()]] | |
| − | + | * [[Manual:DIL Manual/right()|right()]] | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 23:04, 14 November 2026
toupper()
Function (string). Returns a string in upper case.
toupper(s : string)
Returns a copy of s with every small letter made a capital:
toupper("hello!") is "HELLO!". s itself is not changed.
Parameters
| Name | Type | Meaning |
|---|---|---|
| s | string | The string. |
Returns
String: s in upper case; "" for an empty string or one never set.
Notes
- Only the letters a to z change; letters outside ASCII stay as they are.
- To capitalise only the first letter, combine it with left() and
right() as in the example.
Example
dilbegin string capital(s : string);
code
{
return(toupper(left(s, 1)) + right(s, length(s) - 1));
}
dilend
Returns the string with its first letter a capital, as helpzon.zon does with a help topic.