char string library. There is a character string splitting function.
Diff: CharUtil.cpp
- Revision:
- 1:fc299d8c1c7e
- Parent:
- 0:c6bf0554e2f3
- Child:
- 2:dbd6f2a04946
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CharUtil.cpp Sun Dec 03 06:19:23 2017 +0000 @@ -0,0 +1,21 @@ +#include "CharUtil.h" +#include "mbed.h" + +#define MAXITEM 20 // 数字が大きすぎるとメモリーオーバーエラーがでる + +CharUtil::CharUtil() { +} + +int CharUtil::split(char *base, const char *delim, char *outlist[]){ + char *token; + int cnt = 0; + + token = strtok(base, delim); + + while(token != NULL && cnt < MAXITEM) { + outlist[cnt++] = token; + token = strtok(NULL, delim); + } + + return cnt; +} \ No newline at end of file