Category talk:Wren-str: Difference between revisions

→‎Source code: Added an overload of Str.indexOf which starts at a given codepoint offset.
(→‎Source code: Replaced Str.repeat method with a much more efficient version.)
(→‎Source code: Added an overload of Str.indexOf which starts at a given codepoint offset.)
Line 317:
cpCount = cpCount + 1
}
}
 
// Returns the codepoint index (not byte index) at which 'search' first occurs in 's'
// or -1 if 'search' is not found, starting from codepoint offset 'start'.
static indexOf(s, search, start) {
var ss = (start > 0) ? Str.sub(s, start..-1) : s
var ix = Str.indexOf(ss, search)
return (ix >= 0) ? start + ix : -1
}
 
9,482

edits