fix: remove_last was eating an extra character

This commit is contained in:
Francisco Soto
2023-08-17 21:43:21 +08:00
committed by Jun Yang
parent 3bd8d2e557
commit fc2731376f
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ export function remove_last (v: string, l: string) {
const pattern = String(l)
const index = str.lastIndexOf(pattern)
if (index === -1) return str
return str.substring(0, index) + str.substring(index + pattern.length + 1)
return str.substring(0, index) + str.substring(index + pattern.length)
}
export function rstrip (str: string, chars?: string) {