字符串为const char *在Arduino的? [英] String to const char* in Arduino?

查看:3081
本文介绍了字符串为const char *在Arduino的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个变量鸣叫这是一个字符串,它在一开始,我想剪掉一个字符。

I have a variable tweet that is a string and it has a character at the very beginning that I want to clip off.

所以,我想要做的就是使用的strstr()将其删除。这里是我的code:

So what I want to do is use strstr() to remove it. Here's my code:

tweet = strstr(tweet, "]");

不过,我得到这个错误:

However, I get this error:

cannot convert 'String' to 'const char*' for argument '1' to 
'char' strstr(const char*, const char*)

所以,我认为将是转换鸣叫成一个字符。我将如何去这样做?

So my thought would be to convert tweet into a char. How would I go about doing so?

推荐答案

如何使用来代替。这将是不同于字符串类型之间的转换不易混淆。

How about you use substring instead. This will be less confusing than converting between different types of string.

<一个href=\"http://arduino.cc/en/Reference/StringSubstring\">http://arduino.cc/en/Reference/StringSubstring

这篇关于字符串为const char *在Arduino的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆