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

v2: match, <<=, >>=, |=, ~, unsafe, map init

This commit is contained in:
Alexander Medvednikov
2020-02-05 10:00:11 +01:00
parent a61c9c617d
commit 2b433cdf64
7 changed files with 110 additions and 32 deletions

View File

@@ -156,16 +156,16 @@ pub fn (n i64) hex() string {
len := if n >= i64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len)
// QTODO
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
//count := C.sprintf(charptr(hex), '0x%x', n)
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%x', n)
return tos(hex, count)
}
pub fn (n u64) hex() string {
len := if n >= u64(0) { n.str().len + 3 } else { 19 }
hex := malloc(len)
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
//count := C.sprintf(charptr(hex), '0x%lx', n)
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%lx', n)
return tos(hex, count)
}

View File

@@ -688,7 +688,7 @@ pub fn (s string) count(substr string) int {
}
pub fn (s string) contains(p string) bool {
_ = s.index(p) or {
s.index(p) or {
return false
}
return true