- 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?"
- Python應用輕松入門
- Modular Programming in Java 9
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(入門與提高篇)
- Windows內核編程
- Integrating Facebook iOS SDK with Your Application
- Instant PHP Web Scraping
- 軟件測試教程
- Scala編程(第5版)
- ASP.NET求職寶典
- AI自動化測試:技術原理、平臺搭建與工程實踐
- LabVIEW入門與實戰開發100例(第4版)
- Java語言程序設計實用教程(第2版)
- 算法精解:C語言描述
- JavaScript Mobile Application Development
- Flutter從0基礎到App上線