trim correctly (#8388)

Co-authored-by: dave caruso <me@paperdave.net>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
Dylan Conway
2024-01-22 19:57:20 -08:00
committed by GitHub
parent c52e7c57d2
commit 2d1e0dc240
3 changed files with 7 additions and 2 deletions

View File

@@ -698,6 +698,10 @@ pub fn withoutLeadingSlash(this: string) []const u8 {
return std.mem.trimLeft(u8, this, "/");
}
pub fn withoutLeadingPathSeparator(this: string) []const u8 {
return std.mem.trimLeft(u8, this, &.{std.fs.path.sep});
}
pub fn endsWithAny(self: string, str: string) bool {
const end = self[self.len - 1];
for (str) |char| {