mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix endsWith
Former-commit-id: 5d89343b0bd923fd7400770d25b12985eb937f70
This commit is contained in:
@@ -52,19 +52,8 @@ pub fn startsWith(self: string, str: string) bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
pub fn endsWith(self: string, str: string) bool {
|
||||
if (str.len > self.len) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var i: usize = str.len - 1;
|
||||
while (i > 0) : (i -= 1) {
|
||||
if (str[i] != self[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
pub inline fn endsWith(self: string, str: string) bool {
|
||||
return @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
|
||||
}
|
||||
|
||||
pub fn endsWithAny(self: string, str: string) bool {
|
||||
|
||||
Reference in New Issue
Block a user