如何将庞大的Lua字符串成若干小段?

2026-04-01 18:441阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计275个文字,预计阅读时间需要2分钟。

如何将庞大的Lua字符串成若干小段?

c#include

char* GetIcon() { char smallString[]=small string; return Bigggg string 1\n\continuation of string\\n\continuation of string\;}

如何将庞大的Lua字符串成若干小段?

int main() { printf(%s, GetIcon()); return 0;}

我有一个大字符串(一个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="www.lua.org">Lua</A> [[a text between double brackets]] </BODY> </HTML> ]]

这是最接近你要求的东西,但是使用上面的方法可以将换行符嵌入到字符串中,所以这不会直接工作。

您也可以使用字符串连接(使用..):

value = "long text that" .. " I want to carry over" .. "onto multiple lines"

标签:我有

本文共计275个文字,预计阅读时间需要2分钟。

如何将庞大的Lua字符串成若干小段?

c#include

char* GetIcon() { char smallString[]=small string; return Bigggg string 1\n\continuation of string\\n\continuation of string\;}

如何将庞大的Lua字符串成若干小段?

int main() { printf(%s, GetIcon()); return 0;}

我有一个大字符串(一个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="www.lua.org">Lua</A> [[a text between double brackets]] </BODY> </HTML> ]]

这是最接近你要求的东西,但是使用上面的方法可以将换行符嵌入到字符串中,所以这不会直接工作。

您也可以使用字符串连接(使用..):

value = "long text that" .. " I want to carry over" .. "onto multiple lines"

标签:我有