MCPcopy Create free account
hub / github.com/boostorg/build / builtin_split_by_characters

Function builtin_split_by_characters

v2/engine/builtins.c:967–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965 */
966
967LIST * builtin_split_by_characters( FRAME * frame, int flags )
968{
969 LIST * l1 = lol_get( frame->args, 0 );
970 LIST * l2 = lol_get( frame->args, 1 );
971
972 LIST * result = L0;
973
974 string buf[ 1 ];
975
976 char const * delimiters = object_str( list_front( l2 ) );
977 char * t;
978
979 string_copy( buf, object_str( list_front( l1 ) ) );
980
981 t = strtok( buf->value, delimiters );
982 while ( t )
983 {
984 result = list_push_back( result, object_new( t ) );
985 t = strtok( NULL, delimiters );
986 }
987
988 string_free( buf );
989
990 return result;
991}
992
993
994/*

Callers

nothing calls this directly

Calls 6

lol_getFunction · 0.85
object_strFunction · 0.85
string_copyFunction · 0.85
list_push_backFunction · 0.85
object_newFunction · 0.85
string_freeFunction · 0.85

Tested by

no test coverage detected