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

StringUtil.cpp

Committer:
tichise
Date:
2017-12-03
Revision:
0:c6bf0554e2f3

File content as of revision 0:c6bf0554e2f3:

#include "StringUtil.h"
#include "mbed.h"

#define MAXITEM 20 // 数字が大きすぎるとメモリーオーバーエラーがでる

StringUtil::StringUtil() {
}

int StringUtil::splitChar( char *str, const char *delim, char *outlist[] ){
    char *tk;
    int cnt = 0;

    tk = strtok( str, delim );

    while( tk != NULL && cnt < MAXITEM ) {
        outlist[cnt++] = tk;
        tk = strtok( NULL, delim );
    }

    return cnt;
}