![]() | Fun 0.41.5 The programming language that makes You have fun |
String built-ins wrappers used by VM opcodes. More...


Go to the source code of this file.
Functions | |
| Value | bi_split (const Value *str, const Value *sep) |
| Split a string by a separator into an array Value. | |
| Value | bi_join (const Value *arr, const Value *sep) |
| Join an array of strings with a separator into a single string Value. | |
| Value | bi_substr (const Value *str, int start, int len) |
| Extract a substring from a string Value. | |
| int | bi_find (const Value *hay, const Value *needle) |
| Find the first occurrence of a needle inside a haystack string. | |
String built-ins wrappers used by VM opcodes.
Provides small wrapper functions around core string utilities to operate on the Value type used by the VM (split, join, substr, find).
Definition in file string.c.
Find the first occurrence of a needle inside a haystack string.
If either argument is not a VAL_STRING or is NULL, it is treated as an empty string (""). The search is performed by string_find.
| hay | Haystack string (VAL_STRING). May be NULL. |
| needle | Needle string (VAL_STRING). May be NULL. |
Definition at line 96 of file string.c.

Join an array of strings with a separator into a single string Value.
Extracts the separator C string from sep if it is a VAL_STRING, otherwise uses an empty string (""). The join operation is performed by array_join_with_sep.
| arr | Array Value expected to contain strings. Semantics for non-string elements are defined by array_join_with_sep. |
| sep | Separator string (VAL_STRING). May be NULL; defaults to empty. |
Definition at line 56 of file string.c.

Split a string by a separator into an array Value.
Safely extracts C strings from the provided Value arguments. If either argument is NULL, not of type VAL_STRING, or has a NULL s pointer, an empty string ("") is used instead.
| str | Input string (VAL_STRING) to split. May be NULL. |
| sep | Separator string (VAL_STRING). May be NULL. If empty, behavior is defined by string_split_to_array. |
Definition at line 37 of file string.c.

Extract a substring from a string Value.
If str is not a VAL_STRING or is NULL, an empty source string is used. The actual substring extraction semantics (e.g., handling of negative or out-of-range indices) are delegated to string_substr.
| str | Source string (VAL_STRING). May be NULL. |
| start | Zero-based start index. |
| len | Maximum number of characters to include in the substring. |
Definition at line 77 of file string.c.
