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

update all index() uses

This commit is contained in:
Alexander Medvednikov
2019-11-30 15:27:16 +03:00
parent 2651b8957a
commit a23a4ed98a
4 changed files with 20 additions and 18 deletions

View File

@ -113,8 +113,7 @@ fn (r mut Reader) read_record() ?[]string {
for {
// not quoted
if line[0] != `"` {
i = line.index(r.delimiter.str())
if i == -1 {
i = line.index(r.delimiter.str()) or {
// last
break
}
@ -125,8 +124,7 @@ fn (r mut Reader) read_record() ?[]string {
// quoted
else {
line = line[1..]
i = line.index('"')
if i != -1 {
if i := line.index('"') {
if i+1 == line.len {
// last record
fields << line[..i]
@ -145,7 +143,6 @@ fn (r mut Reader) read_record() ?[]string {
return err_invalid_delim
}
}
return fields
}