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

string: make substr() copy the data, like in Java and C#; remove .cstr()

this makes managing memory used by strings much easier
V strings are now fully compatible with C strings
This commit is contained in:
Alexander Medvednikov
2019-07-22 16:51:33 +02:00
parent 59eac5686f
commit 390394b56b
10 changed files with 68 additions and 66 deletions

View File

@ -43,7 +43,7 @@ fn new_scanner(file_path string) *Scanner {
// BOM check
if raw_text.len >= 3 {
c_text := raw_text.cstr()
c_text := raw_text.str
if c_text[0] == 0xEF && c_text[1] == 0xBB && c_text[2] == 0xBF {
// skip three BOM bytes