pub fn replaceScalar(comptime T: type, slice: []T, match: T, replacement: T) void T: typeslice: []Tmatch: Treplacement: T4151
4152
4153
4154
4155
4156pub fn replaceScalar(comptime T: type, slice: []T, match: T, replacement: T) void {
for (slice) |*e| {
if (e.* == match)
e.* = replacement;
}
}
Replace all occurrences of
matchwithreplacement.