From cc2bd0bb68be134a710f34419d240f73bd03a8ee Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 30 Nov 2019 12:50:27 +0300 Subject: [PATCH] string: make substr private --- vlib/builtin/string.v | 3 +-- vlib/eventbus/params.v | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 963f9dc4c2..d89371512b 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -404,8 +404,7 @@ fn (s string) substr2(start, _end int, end_max bool) string { return s.substr(start, end) } -// substr -pub fn (s string) substr(start, end int) string { +fn (s string) substr(start, end int) string { if start > end || start > s.len || end > s.len || start < 0 || end < 0 { panic('substr($start, $end) out of bounds (len=$s.len)') } diff --git a/vlib/eventbus/params.v b/vlib/eventbus/params.v index 13c527146f..47f873945b 100644 --- a/vlib/eventbus/params.v +++ b/vlib/eventbus/params.v @@ -115,7 +115,7 @@ pub fn (p mut Params) put_custom(name string, typ string, data voidptr) { //HELPERS 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) return len }