Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › c/ › wchar.zig › wcstok
wcstok
wchar.wcstok
fn wcstok (noalias maybe_str : ?[*:0 ]wchar_t , noalias values : [*:0 ]const wchar_t , noalias state : *?[*:0 ]wchar_t ) callconv (.c ) ?[*:0 ]wchar_t
File
Code
fn wcstok (noalias maybe_str : ?[*:0 ]wchar_t , noalias values : [*:0 ]const wchar_t , noalias state : *?[*:0 ]wchar_t ) callconv (.c ) ?[*:0 ]wchar_t {
const str = if (maybe_str ) |str |
str
else if (state .*) |state_str |
state_str
else
return null ;
const str_chars = std .mem .span (str );
const values_chars = std .mem .span (values );
const tok_start = std .mem .findNone (wchar_t , str_chars , values_chars ) orelse return null ;
if (std .mem .findAnyPos (wchar_t , str_chars , tok_start , values_chars )) |tok_end | {
str [tok_end ] = 0 ;
state .* = str [tok_end + 1 ..];
} else {
state .* = str [str_chars .len ..];
}
return str [tok_start ..];
}