StrTryInitFromCstr
Description
Try to initialize a Str by copying bytes from a C string buffer.
This public API supports both of these forms:
StrTryInitFromCstr(out, cstr, len)StrTryInitFromCstr(out, cstr, len, alloc)
Omitting the allocator uses DefaultAllocator(). Supplying an allocator overrides the default object allocator for the destination string.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination string. |
cstr |
in | Source character buffer. |
len |
in | Number of bytes to copy from cstr. |
alloc |
in | Optional allocator override for the destination string. |
Success
Returns true. *out is initialized with a copy of cstr’s first len bytes; capacity is at least len + 1 and the chosen allocator is bound. See StrTryInitFromCstrAlloc for full state details.
Failure
Returns false on allocation failure. *out is left as an initialized-but-empty Str.
Usage example (Cross-references)
Usage examples (Cross-references)
No external code usages found in the scanned files.
Last updated on