lib/os: patch TempDir, MkdirTemp, CreateTemp

This commit is contained in:
Aofei Sheng
2024-08-12 18:18:04 +08:00
parent 321766fd46
commit 30b1660005
4 changed files with 133 additions and 6 deletions

View File

@@ -105,3 +105,21 @@ type sliceHead struct {
len int
cap int
}
func LastIndexByte(s []byte, c byte) int {
for i := len(s) - 1; i >= 0; i-- {
if s[i] == c {
return i
}
}
return -1
}
func LastIndexByteString(s string, c byte) int {
for i := len(s) - 1; i >= 0; i-- {
if s[i] == c {
return i
}
}
return -1
}