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:
committed by
Alexander Medvednikov
parent
ed55826686
commit
59378dce46
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user