#how to compare a comptime literal with a runtime-known string as a one liner?

1 messages · Page 1 of 1 (latest)

granite oriole
#

in fact its not even working

#
if (std.mem.eql(u8, model.?.klass.?.name[0..12], "GameBuildingModel")) continue;

This always returns true even when its not

#

name is a [*:0]const u8

humble wharf
#

usually you would do std.mem.eql(u8, std.mem.span(name), "string")

#

and yeah, a length 12 string can never be equal to a length 17 one

granite oriole
#

if (std.mem.orderZ(u8, model.?.klass.?.name, "GameBuildingModel") != .eq) continue;