- 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?"
- DB2 V9權威指南
- Debian 7:System Administration Best Practices
- ASP.NET Core Essentials
- 算法訓練營:提高篇(全彩版)
- Protocol-Oriented Programming with Swift
- C++從入門到精通(第5版)
- C++ System Programming Cookbook
- Instant Apache Camel Messaging System
- 從零學Java設計模式
- ASP.NET本質論
- SOA Patterns with BizTalk Server 2013 and Microsoft Azure(Second Edition)
- 分布式系統架構與開發:技術原理與面試題解析
- Python程序設計現代方法
- MATLAB從入門到精通
- Hadoop MapReduce v2 Cookbook(Second Edition)