int StrSplit( char pstrSrc[], char pstrDst[][], char pstrSeparator);
0以上: 分割した文字列数
-1: 分割対象の文字列サイズが0
-2: 分割後の文字列個数が格納配列サイズよりも大きい
-3: 分割後の文字列長が格納配列サイズよりも大きい
pstrSrc[]: 対象となる文字列
pstrDst[][]: 分割後の文字列格納配列
※配列の要素数[ 最大格納文字列数 ][ 各文字列の最大長 ]
pstrSeparator: 区切り文字列
pstrSrcの文字列をpstrSeparatorで与えられた区切り文字列で分割します。分割後の文字列はpstrDstに格納されます。
pstrSrcの文字列をpstrSeparatorで与えられた区切り文字列で分割します。分割後の文字列はpstrDstに格納されます。
pstrDstの配列要素数は、分割後の文字列数及び各文字列長よりも大きい必要があります。配列要素数よりも分割文字列数及び文字列長が大きい場合は-2もしくは-3を返却します。
RTX64-4.4 以降対応
〇PCベースコントローラ
×InterMotion
void main()
{
char csrc[64];
char cdst[64][16];
char cseparator[64];
int num;
int i;
Sprintf1(csrc, "%s" , "Prime Motion Inc");
Sprintf1(cseparator, "%c", ' ');
num = StrSplit( csrc, cdst, cseparator);
if(num > 0)
{
for(i = 0; i < num; i++)
{
Printf1("%s\n", cdst[i]);
}
}
else
{
Printf1("num = %d\n", num);
}
Sprintf1(csrc, "%s" , "Prime,,Motion,,Inc");
Sprintf1(cseparator, "%s", ",,");
num = StrSplit( csrc, cdst, cseparator);
if(num > 0)
{
for(i = 0; i < num; i++)
{
Printf1("%s\n", cdst[i]);
}
}
else
{
Printf1("num = %d\n", num);
}
}