| author | |
| committer | |
| log | 24fb8bc90898efa2f7c8fa094f9dab80d38ec55e |
| tree | 0ced07dc6b2505a5accafe4ba2cfc9fec084f447 |
| parent | 5410f8ded9b0ad5379cd153cdcd7512f1db6bfd0 |
1 files changed, 7 insertions(+), 0 deletions(-)
src/lib.zig+7| ... | ... | @@ -52,6 +52,13 @@ pub fn trimPrefix(in: string, prefix: string) string { |
| 52 | 52 | return in; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | pub fn trimSuffix(in: string, suffix: string) string { | |
| 56 | if (std.mem.endsWith(u8, in, suffix)) { | |
| 57 | return in[0 .. in.len - suffix.len]; | |
| 58 | } | |
| 59 | return in; | |
| 60 | } | |
| 61 | ||
| 55 | 62 | pub fn base64EncodeAlloc(alloc: std.mem.Allocator, input: string) !string { |
| 56 | 63 | const base64 = std.base64.standard.Encoder; |
| 57 | 64 | var buf = try alloc.alloc(u8, base64.calcSize(input.len)); |