String case: Difference between revisions

Content deleted Content added
Nbdsp (talk | contribs)
Matu3ba (talk | contribs)
add Zig example, remove superfluous link and add important note that toLower and toUpper are not reverseable in every language alphabet
Line 8: Line 8:
<br>
<br>
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.
Use the default encoding of a string literal or plain ASCII if there is no string literal in your language.

Note: In some languages alphabets toLower and toUpper is not reversable.


Show any additional case conversion functions &nbsp; (e.g. swapping case, capitalizing the first letter, etc.) &nbsp; that may be included in the library of your language.
Show any additional case conversion functions &nbsp; (e.g. swapping case, capitalizing the first letter, etc.) &nbsp; that may be included in the library of your language.
Line 3,242: Line 3,244:
{{omit from|PARI/GP|No real capacity for string manipulation}}
{{omit from|PARI/GP|No real capacity for string manipulation}}


=={{header|Zig}}==
[[Category: String manipulation]]
<lang zig>const std = @import("std");
[[Category: Encodings]]


pub fn main() !void {
[[Wikipedia::https://en.wikipedia.org/wiki/Letter_case]]
const stdout_wr = std.io.getStdOut().writer();
const string = "alphaBETA";
var lower: [string.len]u8 = undefined;
var upper: [string.len]u8 = undefined;
for (string) |char, i| {
lower[i] = std.ascii.toLower(char);
upper[i] = std.ascii.toUpper(char);
}
try stdout_wr.print("lower: {s}\n", .{lower});
try stdout_wr.print("upper: {s}\n", .{upper});

// TODO use https://github.com/jecolon/zigstr
}</lang>


=={{header|Zoea}}==
=={{header|Zoea}}==
Line 3,265: Line 3,280:
=={{header|Zoea Visual}}==
=={{header|Zoea Visual}}==
[http://zoea.co.uk/examples/zv-rc/Lowercase.png Lowercase] and [http://zoea.co.uk/examples/zv-rc/Uppercase.png Uppercase]
[http://zoea.co.uk/examples/zv-rc/Lowercase.png Lowercase] and [http://zoea.co.uk/examples/zv-rc/Uppercase.png Uppercase]

[[Category: String manipulation]]
[[Category: Encodings]]