MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / builtin_string_slice1

Function builtin_string_slice1

src/builtin/module_builtin_string.cpp:219–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217 }
218
219 char* builtin_string_slice1 ( const char *str, int start, int end, Context * context, LineInfoArg * at ) {
220 const uint32_t strLen = stringLengthSafe ( *context, str );
221 if (!strLen)
222 return nullptr;
223 start = clamp_int((start < 0) ? (strLen + start) : start, 0, strLen);
224 end = clamp_int((end < 0) ? (strLen + end) : end, 0, strLen);
225 return end > start ? context->allocateString(str + start, uint32_t(end-start), at) : nullptr;
226 }
227
228 char* builtin_string_slice2 ( const char *str, int start, Context * context, LineInfoArg * at ) {
229 const uint32_t strLen = stringLengthSafe ( *context, str );

Callers

nothing calls this directly

Calls 3

stringLengthSafeFunction · 0.85
clamp_intFunction · 0.85
allocateStringMethod · 0.80

Tested by

no test coverage detected