@@ -329,7 +329,7 @@ pub fn (a string) clone() string {
329
329
return b
330
330
}
331
331
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`.
333
333
pub fn (s string) replace_once (rep string , with string ) string {
334
334
idx := s.index_ (rep)
335
335
if idx == - 1 {
@@ -338,7 +338,7 @@ pub fn (s string) replace_once(rep string, with string) string {
338
338
return s.substr (0 , idx) + with + s.substr (idx + rep.len, s.len)
339
339
}
340
340
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`.
342
342
[direct_array_access ]
343
343
pub fn (s string) replace (rep string , with string ) string {
344
344
if s.len == 0 || rep.len == 0 || rep.len > s.len {
@@ -406,7 +406,7 @@ struct RepIndex {
406
406
val_idx int
407
407
}
408
408
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`.
410
410
// Example: assert 'ABCD'.replace_each(['B','C/','C','D','D','C']) == 'AC/DC'
411
411
[direct_array_access ]
412
412
pub fn (s string) replace_each (vals []string ) string {
@@ -496,7 +496,7 @@ pub fn (s string) replace_each(vals []string) string {
496
496
}
497
497
}
498
498
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`.
500
500
// Example: assert '\tHello!'.replace_char(`\t`,` `,8) == ' Hello!'
501
501
[direct_array_access ]
502
502
pub 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 {
900
900
}
901
901
else {
902
902
mut start := 0
903
- // Take the left part for each delimiter occurence
903
+ // Take the left part for each delimiter occurrence
904
904
for i < = s.len {
905
905
is_delim := i + delim.len < = s.len && s.substr (i, i + delim.len) == delim
906
906
if is_delim {
@@ -1204,7 +1204,7 @@ pub fn (s string) index_any(chars string) int {
1204
1204
return - 1
1205
1205
}
1206
1206
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.
1208
1208
[direct_array_access ]
1209
1209
fn (s string) last_index_ (p string ) int {
1210
1210
if p.len > s.len || p.len == 0 {
@@ -1224,7 +1224,7 @@ fn (s string) last_index_(p string) int {
1224
1224
return - 1
1225
1225
}
1226
1226
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.
1228
1228
pub fn (s string) last_index (p string ) ? int {
1229
1229
idx := s.last_index_ (p)
1230
1230
if idx == - 1 {
@@ -1274,7 +1274,7 @@ pub fn (s string) index_u8(c u8) int {
1274
1274
return - 1
1275
1275
}
1276
1276
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.
1278
1278
// last_index_byte returns -1 if the byte is not found.
1279
1279
[direct_array_access ]
1280
1280
pub fn (s string) last_index_u8 (c u8 ) int {
@@ -1853,7 +1853,7 @@ pub fn (s string) all_before(sub string) string {
1853
1853
return s[..pos]
1854
1854
}
1855
1855
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.
1857
1857
// If the substring is not found, it returns the full input string.
1858
1858
// Example: assert '23:34:45.234'.all_before_last(':') == '23:34'
1859
1859
// Example: assert 'abcd'.all_before_last('.') == 'abcd'
@@ -1877,7 +1877,7 @@ pub fn (s string) all_after(sub string) string {
1877
1877
return s[pos + sub.len..]
1878
1878
}
1879
1879
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.
1881
1881
// If the substring is not found, it returns the full input string.
1882
1882
// Example: assert '23:34:45.234'.all_after_last(':') == '45.234'
1883
1883
// Example: assert 'abcd'.all_after_last('z') == 'abcd'
@@ -1889,7 +1889,7 @@ pub fn (s string) all_after_last(sub string) string {
1889
1889
return s[pos + sub.len..]
1890
1890
}
1891
1891
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.
1893
1893
// If the substring is not found, it returns the full input string.
1894
1894
// Example: assert '23:34:45.234'.all_after_first(':') == '34:45.234'
1895
1895
// Example: assert 'abcd'.all_after_first('z') == 'abcd'
@@ -1901,7 +1901,7 @@ pub fn (s string) all_after_first(sub string) string {
1901
1901
return s[pos + sub.len..]
1902
1902
}
1903
1903
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.
1905
1905
// If the substring is not found, it returns the full input string.
1906
1906
// Example: assert '23:34:45.234'.after(':') == '45.234'
1907
1907
// Example: assert 'abcd'.after('z') == 'abcd'
@@ -1911,7 +1911,7 @@ pub fn (s string) after(sub string) string {
1911
1911
return s.all_after_last (sub)
1912
1912
}
1913
1913
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.
1915
1915
// If the substring is not found, it returns the full input string.
1916
1916
// Example: assert '23:34:45.234'.after_char(`:`) == '34:45.234'
1917
1917
// Example: assert 'abcd'.after_char(`:`) == 'abcd'
0 commit comments