stm32 字符串截取
时间: 2023-10-08 22:14:43 浏览: 266
在STM32中进行字符串截取可以使用C语言中的字符串处理函数来实现。你可以使用strtok函数将字符串按照指定的分隔符进行分割,然后获取到你需要的子字符串。下面是一个示例代码:
```c
#include <stdio.h>
#include <string.h>
int split(char dst[][80], char* str, const char* spl) {
int n = 0;
char *result = NULL;
result = strtok(str, spl);
while( result != NULL ) {
strcpy(dst[n], result);
result = strtok(NULL, spl);
n++;
}
return n;
}
int main() {
char str[] = "what is your name?";
char dst<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [stm32之蓝牙通信PWM调灯亮度(使用字符串切割)](https://blog.csdn.net/m0_67069564/article/details/129809267)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [字符串切割函数和字符数组转int数据函数的实现](https://blog.csdn.net/qq_41923988/article/details/106504919)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [STM32中自己定义AT指令,取出字符串中间任意数据的方法](https://blog.csdn.net/qq_39758638/article/details/106603216)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文