- Corona SDK Mobile Game Development:Beginner's Guide
- Michelle M. Fernandez
- 204字
- 2021-08-06 19:59:46
Strings
Earlier in this chapter, you saw some code examples using sequences of characters. Those sequences of characters are called strings. Strings may contain characters with any numeric value, including embedded zeros. This also means that binary data can be stored in a string.
Quoting strings
There are three ways to quote strings: with double quotes, with single quotes and with square brackets.
Using double quote characters "
mark the beginning and end of the string. For example:
print("This is my string.") -- This is my string.
You can also quote strings by using the single quote character '
. Single quotes work the same as double quotes except that single-quoted strings can contain a double quote.
print('This is another string.') -- This is another string. print('She said, "Hello!" ') -- She said, "Hello!"
Lastly, using a pairs of square brackets will also quote strings. They are used mainly for strings when double or single quotes cannot be used. There are not many cases that this occurs, but they will do the job.
print([[Is it 'this' or "that?"]]) -- Is it 'this' or "that?"
- Cortex-M3 + μC/OS-II嵌入式系統開發入門與應用
- 數字道路技術架構與建設指南
- Effective STL中文版:50條有效使用STL的經驗(雙色)
- 計算機組裝·維護與故障排除
- 計算機應用與維護基礎教程
- Large Scale Machine Learning with Python
- Visual Media Processing Using Matlab Beginner's Guide
- OpenGL Game Development By Example
- 基于Proteus仿真的51單片機應用
- 數字媒體專業英語(第2版)
- Wireframing Essentials
- FL Studio Cookbook
- 計算機組成技術教程
- Corona SDK Mobile Game Development:Beginner's Guide
- 計算機應用基礎案例教程(Windows 7+Office 2010)