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

builtin: x.vstring() instead of string(x) (#6102)

This commit is contained in:
Delyan Angelov
2020-08-10 19:05:26 +03:00
committed by GitHub
parent eba413853f
commit 36eae1c175
30 changed files with 143 additions and 72 deletions

View File

@@ -141,7 +141,7 @@ pub fn string(len int) string {
buf[i] = chars[intn(chars.len)]
}
}
return string(buf, len)
return unsafe { buf.vstring_with_len(len) }
}
// rand.uuid_v4 generate a completely random UUID (v4)
@@ -181,7 +181,7 @@ pub fn uuid_v4() string {
buf[14] = `4`
buf[buflen] = 0
}
return string(buf, buflen)
return unsafe { buf.vstring_with_len(buflen) }
}
const(
@@ -232,5 +232,5 @@ pub fn ulid_at_millisecond(unix_time_milli u64) string {
unsafe{
buf[26] = 0
}
return string(buf, buflen)
return unsafe { buf.vstring_with_len(buflen) }
}