Function allocUpperString [src]
Allocates an upper case copy of ascii_string.
Caller owns returned string and must free with allocator.
Prototype
pub fn allocUpperString(allocator: std.mem.Allocator, ascii_string: []const u8) ![]u8
Parameters
allocator: std.mem.Allocator
ascii_string: []const u8
Example
test allocUpperString {
const result = try allocUpperString(std.testing.allocator, "aBcDeFgHiJkLmNOPqrst0234+💩!");
defer std.testing.allocator.free(result);
try std.testing.expectEqualStrings("ABCDEFGHIJKLMNOPQRST0234+💩!", result);
}
Source
pub fn allocUpperString(allocator: std.mem.Allocator, ascii_string: []const u8) ![]u8 {
const result = try allocator.alloc(u8, ascii_string.len);
return upperString(result, ascii_string);
}