char string library. There is a character string splitting function.

Committer:
tichise
Date:
Sun Dec 03 05:35:31 2017 +0000
Revision:
0:c6bf0554e2f3
StringUtil???

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tichise 0:c6bf0554e2f3 1 #include "StringUtil.h"
tichise 0:c6bf0554e2f3 2 #include "mbed.h"
tichise 0:c6bf0554e2f3 3
tichise 0:c6bf0554e2f3 4 #define MAXITEM 20 // 数字が大きすぎるとメモリーオーバーエラーがでる
tichise 0:c6bf0554e2f3 5
tichise 0:c6bf0554e2f3 6 StringUtil::StringUtil() {
tichise 0:c6bf0554e2f3 7 }
tichise 0:c6bf0554e2f3 8
tichise 0:c6bf0554e2f3 9 int StringUtil::splitChar( char *str, const char *delim, char *outlist[] ){
tichise 0:c6bf0554e2f3 10 char *tk;
tichise 0:c6bf0554e2f3 11 int cnt = 0;
tichise 0:c6bf0554e2f3 12
tichise 0:c6bf0554e2f3 13 tk = strtok( str, delim );
tichise 0:c6bf0554e2f3 14
tichise 0:c6bf0554e2f3 15 while( tk != NULL && cnt < MAXITEM ) {
tichise 0:c6bf0554e2f3 16 outlist[cnt++] = tk;
tichise 0:c6bf0554e2f3 17 tk = strtok( NULL, delim );
tichise 0:c6bf0554e2f3 18 }
tichise 0:c6bf0554e2f3 19
tichise 0:c6bf0554e2f3 20 return cnt;
tichise 0:c6bf0554e2f3 21 }