String case: Difference between revisions

→‎{{header|Zig}}: zigstr project has moved; update link in TODO
mNo edit summary
(→‎{{header|Zig}}: zigstr project has moved; update link in TODO)
 
(4 intermediate revisions by 4 users not shown)
Line 1,619:
OUTPUT (LowerCased);
OUTPUT (TitleCased);</syntaxhighlight>
 
=={{header|Ecstasy}}==
The methods on <code>String</code> are <code>toUppercase()</code> and <code>toLowercase()</code>:
 
<syntaxhighlight lang="ecstasy">
module test {
void run() {
@Inject Console console;
console.print($"{"alphaBETA".toLowercase()=}");
console.print($"{"alphaBETA".toUppercase()=}");
}
}
</syntaxhighlight>
 
{{out}}
<pre>
x$ xec test
"alphaBETA".toLowercase()=alphabeta
"alphaBETA".toUppercase()=ALPHABETA
</pre>
 
=={{header|Elena}}==
Line 2,911 ⟶ 2,931:
Lower case : alphabeta
</pre>
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
var s := 'exAmpLe sTrinG';
s.ToLower.Println;
s.ToUpper.Println;
</syntaxhighlight>
{{out}}
<pre>
example string
EXAMPLE STRING
</pre>
 
 
 
=={{header|Peloton}}==
Line 3,778 ⟶ 3,813:
ALPHABETA
ALPHABETA
</pre>
 
=={{header|Uiua}}==
{{works with|Uiua|0.11.1}}
<syntaxhighlight lang="uiua">
¯"alphaBETA" # swapcase
⌵"alphaBETA" # upper
¯⌵"alphaBETA" # lower
±"alphaBETA123" # case mask 1=upper, -1=lower, 0=neither
</syntaxhighlight>
{{out}}
<pre>
"ALPHAbeta"
"ALPHABETA"
"alphabeta"
[¯1 ¯1 ¯1 ¯1 ¯1 1 1 1 1 0 0 0]
</pre>
 
Line 3,913 ⟶ 3,964:
 
The 'Utf8' class recently acquired the first four of the above methods though with considerably wider (albeit still incomplete) Unicode coverage. In particular the upper case variants 'ẞ' and 'Ÿ' are now supported - the former was introduced into official German orthography in 2017 (though is optional) and, of course, now round-trips. Title case for 4 supported digraphs is automatically applied by the ''capitalize'' or ''title'' methods when they are the first character of the string (or, word, in the case of the latter).
<syntaxhighlight lang="ecmascriptwren">import "./str" for Str, Utf8
 
var strs = ["alphaBETA", "ação", "o'hare O'HARE o’hare don't"]
Line 4,117 ⟶ 4,168:
try stdout_wr.print("upper: {s}\n", .{upper});
 
// TODO use https://githubcodeberg.comorg/jecolondude_the_builder/zigstr
}</syntaxhighlight>
 
1

edit