比较和更改Arduino Nodemcu中字符串的内容
我有一个字符串,但我似乎无法更改其内容。 我想检查字符串是否包含“ Relay1”,并且是否应该将其内容更改为“ 15”。
if (inputMessage1 == "relay1") {
inputMessage1.replace("relay1", "15");
}
我还尝试了“ InputMessage.comPareto()”,但没有尝试。 因此,这真的很简单,但我正在四处走动。
I have a string but i don't seem to be able to change its content.
I want to check if the string contains "relay1" and if it does it should change its content to "15".
if (inputMessage1 == "relay1") {
inputMessage1.replace("relay1", "15");
}
I have also tried with 'inputMessage.compareto()' but nothing.
So this is suppose to be really simple but i am going around and around.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以检查这两个平等是否等于:
如果您要检查包含文本是否,则可以使用以下方式:
You can check if both equals like:
if do you want to check if contains text or not then you can use like: