【发布时间】:2016-11-04 14:52:01
【问题描述】:
我正在寻找一种使用 Arduino 在 2 个字符串之间获取字符串的方法。这是源字符串:
Hello, my name is John Doe# and my favourite number is 32#.
输出必须是:
String name = "John Doe"; //Between "name is " and "#"
String favouriteNumber = "32"; //Between "number is " and "#"
如何使用 Arduino 实现这一点?
我无法在网上找到任何有关此的信息。 C 的那些示例无论如何都不起作用。我知道在 Arduino 中不建议使用 String,但我必须这样做以使事情变得更简单。
顺便说一句,这种使用“#”表示数据结束的方法并不是一种理想的方法,因为我希望输入更易于阅读和更自然。 是否有人也可以建议另一种方法来做到这一点?
提前致谢!
【问题讨论】:
-
>
but I have to do it this way to make things simpler.这是你的错误:在 Arduino C 中,char*strings 更强大。