#string to int cast

1 messages · Page 1 of 1 (latest)

simple dome
#

Try std.mem.readInt(u16, &"ex");

coral oracle
#

the & is incorrect

#

that would yield a *const *const [2:0]u8

#

var xy: u16 = @bitCast(@as([2]u8, "ex".*)); should work here

simple dome
#

Oh, right. I'm still stuggling with strings vs slices of bytes.