mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
string: make substr private
This commit is contained in:
parent
1a0b78ae2f
commit
cc2bd0bb68
@ -404,8 +404,7 @@ fn (s string) substr2(start, _end int, end_max bool) string {
|
|||||||
return s.substr(start, end)
|
return s.substr(start, end)
|
||||||
}
|
}
|
||||||
|
|
||||||
// substr
|
fn (s string) substr(start, end int) string {
|
||||||
pub fn (s string) substr(start, end int) string {
|
|
||||||
if start > end || start > s.len || end > s.len || start < 0 || end < 0 {
|
if start > end || start > s.len || end > s.len || start < 0 || end < 0 {
|
||||||
panic('substr($start, $end) out of bounds (len=$s.len)')
|
panic('substr($start, $end) out of bounds (len=$s.len)')
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ pub fn (p mut Params) put_custom(name string, typ string, data voidptr) {
|
|||||||
//HELPERS
|
//HELPERS
|
||||||
|
|
||||||
fn parse_len(typ, s_tok, e_tok string) int {
|
fn parse_len(typ, s_tok, e_tok string) int {
|
||||||
len := typ.substr(typ.index(s_tok) + 1, typ.index(e_tok)).int()
|
len := typ[typ.index(s_tok) + 1 .. typ.index(e_tok)].int()
|
||||||
//t := typ.substr(typ.index(e_tok) + 1, typ.len)
|
//t := typ.substr(typ.index(e_tok) + 1, typ.len)
|
||||||
return len
|
return len
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user