gpt4 book ai didi

java - 在字符串中插入变量

转载 作者:行者123 更新时间:2023-11-29 04:38:44 26 4
gpt4 key购买 nike

这可能是一个非常简单的问题,但由于我使用的是 1.3 IDE,所以我无法使用最常用的方法来完成此操作。

String at_cmd_response = atc.send("AT+CMGS=\"+35111111111\"\r");

我需要引入一个名为 number 的字符串,它在 at_cmd_response 中包含一个类似“35191xxxxxxx”的数字。为此,我看到了 String.format 方法,但由于我的 IDE 而无法使用它。

还有其他方法吗?

谢谢

最佳答案

简单的字符串连接 (+) 将起作用:

String at_cmd_response = atc.send("AT+CMGS=\""+number+"\"\r");

关于java - 在字符串中插入变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40150323/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com