- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- Michelle M. Fernandez
- 194字
- 2021-07-23 19:37:18
Strings
Earlier in this chapter, you saw some code examples using sequences of characters. Those sequences of characters are called strings. Strings may consist of any character, including numeric values.
Quoting strings
There are three ways to quote strings: with double quotes, with single quotes, and with square brackets.
Double quote characters "
mark the beginning and end of the string. Here is an example:
print("This is my string.") -- This is my string.
You can also quote strings using the single quote character '
. Single quotes work the same as double quotes, except that single-quoted strings can contain a double quote. Here is an example:
print('This is another string.') -- This is another string. print('She said, "Hello!" ') -- She said, "Hello!"
Finally, using a pair 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 where this occurs, but they will do the job:
print([[Is it 'this' or "that?"]]) -- Is it 'this' or "that?"
- Getting Started with Citrix XenApp? 7.6
- DevOps入門與實踐
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- 青少年Python編程入門
- Python編程實戰
- Scala程序員面試算法寶典
- Instant Nancy Web Development
- ServiceNow:Building Powerful Workflows
- 小型編譯器設計實踐
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Emotional Intelligence for IT Professionals
- 深入解析Java編譯器:源碼剖析與實例詳解
- Delphi開發典型模塊大全(修訂版)
- 現代C++語言核心特性解析
- React and React Native