@@ -329,7 +329,7 @@ pub fn (a string) clone() string {
329329 return b
330330}
331331
332- // replace_once replaces the first occurence of `rep` with the string passed in `with`.
332+ // replace_once replaces the first occurrence of `rep` with the string passed in `with`.
333333pub fn (s string) replace_once (rep string , with string ) string {
334334 idx := s.index_ (rep)
335335 if idx == - 1 {
@@ -338,7 +338,7 @@ pub fn (s string) replace_once(rep string, with string) string {
338338 return s.substr (0 , idx) + with + s.substr (idx + rep.len, s.len)
339339}
340340
341- // replace replaces all occurences of `rep` with the string passed in `with`.
341+ // replace replaces all occurrences of `rep` with the string passed in `with`.
342342[direct_array_access ]
343343pub fn (s string) replace (rep string , with string ) string {
344344 if s.len == 0 || rep.len == 0 || rep.len > s.len {
@@ -406,7 +406,7 @@ struct RepIndex {
406406 val_idx int
407407}
408408
409- // replace_each replaces all occurences of the string pairs given in `vals`.
409+ // replace_each replaces all occurrences of the string pairs given in `vals`.
410410// Example: assert 'ABCD'.replace_each(['B','C/','C','D','D','C']) == 'AC/DC'
411411[direct_array_access ]
412412pub fn (s string) replace_each (vals []string ) string {
@@ -496,7 +496,7 @@ pub fn (s string) replace_each(vals []string) string {
496496 }
497497}
498498
499- // replace_char replaces all occurences of the character `rep` multiple occurences of the character passed in `with` with respect to `repeat`.
499+ // replace_char replaces all occurrences of the character `rep` multiple occurrences of the character passed in `with` with respect to `repeat`.
500500// Example: assert '\tHello!'.replace_char(`\t`,` `,8) == ' Hello!'
501501[direct_array_access ]
502502pub fn (s string) replace_char (rep u8 , with u8 , repeat int ) string {
@@ -900,7 +900,7 @@ pub fn (s string) split_nth(delim string, nth int) []string {
900900 }
901901 else {
902902 mut start := 0
903- // Take the left part for each delimiter occurence
903+ // Take the left part for each delimiter occurrence
904904 for i < = s.len {
905905 is_delim := i + delim.len < = s.len && s.substr (i, i + delim.len) == delim
906906 if is_delim {
@@ -1204,7 +1204,7 @@ pub fn (s string) index_any(chars string) int {
12041204 return - 1
12051205}
12061206
1207- // last_index returns the position of the last occurence of the input string.
1207+ // last_index returns the position of the last occurrence of the input string.
12081208[direct_array_access ]
12091209fn (s string) last_index_ (p string ) int {
12101210 if p.len > s.len || p.len == 0 {
@@ -1224,7 +1224,7 @@ fn (s string) last_index_(p string) int {
12241224 return - 1
12251225}
12261226
1227- // last_index returns the position of the last occurence of the input string.
1227+ // last_index returns the position of the last occurrence of the input string.
12281228pub fn (s string) last_index (p string ) ? int {
12291229 idx := s.last_index_ (p)
12301230 if idx == - 1 {
@@ -1274,7 +1274,7 @@ pub fn (s string) index_u8(c u8) int {
12741274 return - 1
12751275}
12761276
1277- // last_index_byte returns the index of the last occurence of byte `c` if found in the string.
1277+ // last_index_byte returns the index of the last occurrence of byte `c` if found in the string.
12781278// last_index_byte returns -1 if the byte is not found.
12791279[direct_array_access ]
12801280pub fn (s string) last_index_u8 (c u8 ) int {
@@ -1853,7 +1853,7 @@ pub fn (s string) all_before(sub string) string {
18531853 return s[..pos]
18541854}
18551855
1856- // all_before_last returns the contents before the last occurence of `sub` in the string.
1856+ // all_before_last returns the contents before the last occurrence of `sub` in the string.
18571857// If the substring is not found, it returns the full input string.
18581858// Example: assert '23:34:45.234'.all_before_last(':') == '23:34'
18591859// Example: assert 'abcd'.all_before_last('.') == 'abcd'
@@ -1877,7 +1877,7 @@ pub fn (s string) all_after(sub string) string {
18771877 return s[pos + sub.len..]
18781878}
18791879
1880- // all_after_last returns the contents after the last occurence of `sub` in the string.
1880+ // all_after_last returns the contents after the last occurrence of `sub` in the string.
18811881// If the substring is not found, it returns the full input string.
18821882// Example: assert '23:34:45.234'.all_after_last(':') == '45.234'
18831883// Example: assert 'abcd'.all_after_last('z') == 'abcd'
@@ -1889,7 +1889,7 @@ pub fn (s string) all_after_last(sub string) string {
18891889 return s[pos + sub.len..]
18901890}
18911891
1892- // all_after_first returns the contents after the first occurence of `sub` in the string.
1892+ // all_after_first returns the contents after the first occurrence of `sub` in the string.
18931893// If the substring is not found, it returns the full input string.
18941894// Example: assert '23:34:45.234'.all_after_first(':') == '34:45.234'
18951895// Example: assert 'abcd'.all_after_first('z') == 'abcd'
@@ -1901,7 +1901,7 @@ pub fn (s string) all_after_first(sub string) string {
19011901 return s[pos + sub.len..]
19021902}
19031903
1904- // after returns the contents after the last occurence of `sub` in the string.
1904+ // after returns the contents after the last occurrence of `sub` in the string.
19051905// If the substring is not found, it returns the full input string.
19061906// Example: assert '23:34:45.234'.after(':') == '45.234'
19071907// Example: assert 'abcd'.after('z') == 'abcd'
@@ -1911,7 +1911,7 @@ pub fn (s string) after(sub string) string {
19111911 return s.all_after_last (sub)
19121912}
19131913
1914- // after_char returns the contents after the first occurence of `sub` character in the string.
1914+ // after_char returns the contents after the first occurrence of `sub` character in the string.
19151915// If the substring is not found, it returns the full input string.
19161916// Example: assert '23:34:45.234'.after_char(`:`) == '34:45.234'
19171917// Example: assert 'abcd'.after_char(`:`) == 'abcd'
0 commit comments