1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler/vlib: replace substr/left/right with [start..end] everywhere

This commit is contained in:
joe-conigliaro
2019-10-27 18:03:15 +11:00
committed by Alexander Medvednikov
parent ed55826686
commit 59378dce46
49 changed files with 308 additions and 306 deletions

View File

@@ -42,7 +42,7 @@ fn (s mut ChunkScanner) skip_crlf() {
fn (s mut ChunkScanner) read_chunk(chunksize int) string {
startpos := s.pos
s.pos += chunksize
return s.text.substr(startpos, s.pos)
return s.text[startpos..s.pos]
}
pub fn decode(text string) string {

View File

@@ -188,10 +188,10 @@ fn parse_response(resp string) Response {
if nl_pos == -1 {
break
}
h := resp.substr(old_pos + 1, nl_pos)
h := resp[old_pos + 1..nl_pos]
// End of headers
if h.len <= 1 {
text = resp.right(nl_pos + 1)
text = resp[nl_pos + 1..]
break
}
i++
@@ -202,8 +202,8 @@ fn parse_response(resp string) Response {
//if h.contains('Content-Type') {
//continue
//}
key := h.left(pos)
val := h.right(pos + 2)
key := h[..pos]
val := h[pos + 2..]
headers[key] = val.trim_space()
}