Function upperString [src]
Writes an upper case copy of ascii_string to output.
Asserts output.len >= ascii_string.len.
Prototype
pub fn upperString(output: []u8, ascii_string: []const u8) []u8
Parameters
output: []u8
ascii_string: []const u8
Example
test upperString {
var buf: [1024]u8 = undefined;
const result = upperString(&buf, "aBcDeFgHiJkLmNOPqrst0234+💩!");
try std.testing.expectEqualStrings("ABCDEFGHIJKLMNOPQRST0234+💩!", result);
}
Source
pub fn upperString(output: []u8, ascii_string: []const u8) []u8 {
std.debug.assert(output.len >= ascii_string.len);
for (ascii_string, 0..) |c, i| {
output[i] = toUpper(c);
}
return output[0..ascii_string.len];
}