strarr=char2strarr(chr,[splt])
chr : | char chain with quation mark separated strings | |
splt : | splitchar default is '"' |
strarr : | string array |
x= '"START" "move a from b to table" "move b from c to a" "move c from table to b" "FINISH"'
y=char2strarr(x)
u=strarr2char(y)
x='space on $A, space on $B, $A on $B'
char2strarr(x,',')
This function, char2strarr
, is designed to convert a character chain containing strings separated by a specified delimiter into a string array. It is part of the SolidGeometry library, version 5.4, and was introduced by Tim Lueth in December 2023.
getfuncparams
function. If no delimiter is provided, it defaults to a quotation mark ('"').split
function is used to divide the input character chain chr
into parts based on the specified delimiter splt
.strtrim
function is applied to remove any leading or trailing whitespace from each of the split strings.strarr(~ismember(strarr,''))
.Consider the following example:
x = '"START" "move a from b to table" "move b from c to a" "move c from table to b" "FINISH"'; y = char2strarr(x);
This will convert the character chain x
into a string array y
with each quoted segment as an element.
Another example with a different delimiter:
x = 'space on $A, space on $B, $A on $B'; char2strarr(x, ',');
Here, the delimiter is a comma, and the function will split the string accordingly.
Algorithm explaination created using ChatGPT on 2025-08-18 23:47. (Please note: No guarantee for the correctness of this explanation)