| author | |
| committer | |
| log | 13f985e368b9ff32f972282fe41faad2d60b6670 |
| tree | 94ea34ae8a5e3b4eb986258e983c924b06d0efbb |
| parent | b16f583d5af5c86c92237bf56fa8063a5e9961c3 |
| signature |
1 files changed, 11 insertions(+), 0 deletions(-)
src/lib.zig+11| ... | ... | @@ -230,3 +230,14 @@ pub fn TagNameJsonStringifyMixin(comptime S: type) type { |
| 230 | 230 | } |
| 231 | 231 | }; |
| 232 | 232 | } |
| 233 | ||
| 234 | pub fn countScalar(comptime T: type, haystack: []const T, needle: T) usize { | |
| 235 | var found: usize = 0; | |
| 236 | ||
| 237 | for (haystack) |item| { | |
| 238 | if (item == needle) { | |
| 239 | found += 1; | |
| 240 | } | |
| 241 | } | |
| 242 | return found; | |
| 243 | } |