endsWith("") should return true

Former-commit-id: fdbb66abc4e539ef960a72588495cd9964eff68b
This commit is contained in:
Jarred Sumner
2021-09-02 19:26:07 -07:00
parent 2e58176ac7
commit 3fc0c899c9

View File

@@ -203,7 +203,7 @@ pub fn startsWith(self: string, str: string) bool {
}
pub inline fn endsWith(self: string, str: string) bool {
return @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
return str.len == 0 or @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
}
pub fn endsWithAny(self: string, str: string) bool {