我有一个大字符串(一个base64编码的图像),它是1050个字符长。如何在C中附加一个由小的字符串构成的大字符串
function GetIcon() return "Bigggg string 1"\ "continuation of string"\ "continuation of string"\ "End of string"
解决方法
根据
Programming in Lua 2.4 Strings:
We can delimit literal strings also by matching double square brackets [[…]]. Literals in this bracketed form may run for several lines,may nest,and do not interpret escape sequences. Moreover,this form ignores the first character of the string when this character is a newline. This form is especially convenient for writing strings that contain program pieces; for instance,
page = [[ <HTML> <HEAD> <TITLE>An HTML Page</TITLE> </HEAD> <BODY> <A HREF="http://www.lua.org">Lua</A> [[a text between double brackets]] </BODY> </HTML> ]]
这是最接近你要求的东西,但是使用上面的方法可以将换行符嵌入到字符串中,所以这不会直接工作。
您也可以使用字符串连接(使用..):
value = "long text that" .. " I want to carry over" .. "onto multiple lines"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。