mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
autofree: string.replace() test
This commit is contained in:
@ -183,6 +183,11 @@ pub fn (s string) replace(rep string, with string) string {
|
||||
// TODO PERF Allocating ints is expensive. Should be a stack array
|
||||
// Get locations of all reps within this string
|
||||
mut idxs := []int{}
|
||||
defer {
|
||||
unsafe {
|
||||
idxs.free()
|
||||
}
|
||||
}
|
||||
mut idx := 0
|
||||
for {
|
||||
idx = s.index_after(rep, idx)
|
||||
|
Reference in New Issue
Block a user