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