mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: a temporary []byte.str2() (until runes are implemented)
This commit is contained in:
parent
f6a85d5305
commit
94f4dfe85b
@ -411,6 +411,18 @@ pub fn (b []byte) clone() []byte {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (b []byte) str2() string {
|
||||||
|
return bytes2string(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO copy pasted from builder.v
|
||||||
|
fn bytes2string(b []byte) string {
|
||||||
|
mut copy := b.clone()
|
||||||
|
copy << `\0`
|
||||||
|
res := tos(copy.data, copy.len-1)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO generic
|
// TODO generic
|
||||||
pub fn (a []byte) contains(val byte) bool {
|
pub fn (a []byte) contains(val byte) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user