Difference between revisions of "Manual:DIL Manual/tolower()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = tolower() = | |
| + | '''Function''' (string). Returns a string in lower case. | ||
| + | tolower(s : string) | ||
| − | + | Returns a copy of <code>s</code> with every capital letter made small: | |
| − | + | <code>tolower("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 lower 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. | |
| − | + | * <code>==</code> on strings already ignores case. Use <code>tolower()</code> where case does | |
| − | + | matter: file names, [[Manual:DIL Manual/getcmd()|getcmd()]], | |
| − | + | [[Manual:DIL Manual/replace()|replace()]], <code><</code> and <code>></code>. | |
| − | + | == Example == | |
| − | + | <pre> | |
| + | dilbegin got_mail(); | ||
| + | var | ||
| + | ml : unitptr; | ||
| + | code | ||
| + | { | ||
| + | ml := restore(tolower(self.name), null); | ||
| + | |||
| + | if (ml != null) | ||
| + | { | ||
| + | act("<div class='mail'>You have a sudden urge to visit the post office.</div>", | ||
| + | A_ALWAYS, self, null, null, TO_CHAR); | ||
| + | destroy(ml); | ||
| + | } | ||
| + | |||
| + | quit; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | From mail.zon: at login, checks whether mail was stored for the player under their name in | ||
| + | lower case. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/toupper()|toupper()]] | ||
| + | * [[Manual:DIL Manual/strcmp()|strcmp()]] | ||
| + | * [[Manual:DIL Manual/restore()|restore()]] | ||
Latest revision as of 23:04, 14 November 2026
tolower()
Function (string). Returns a string in lower case.
tolower(s : string)
Returns a copy of s with every capital letter made small:
tolower("HELLO!") is "hello!". s itself is not changed.
Parameters
| Name | Type | Meaning |
|---|---|---|
| s | string | The string. |
Returns
String: s in lower case; "" for an empty string or one never set.
Notes
- Only the letters A to Z change; letters outside ASCII stay as they are.
==on strings already ignores case. Usetolower()where case does
matter: file names, getcmd(), replace(),<and>.
Example
dilbegin got_mail();
var
ml : unitptr;
code
{
ml := restore(tolower(self.name), null);
if (ml != null)
{
act("<div class='mail'>You have a sudden urge to visit the post office.</div>",
A_ALWAYS, self, null, null, TO_CHAR);
destroy(ml);
}
quit;
}
dilend
From mail.zon: at login, checks whether mail was stored for the player under their name in lower case.