string.gsub
string.gsub Function | |
---|---|
Syntax string.gsub(
Colon notation: sentence:gsub(
| |
Returns | string |
API | string |
Source | Lua (source) |
Replaces a string in a sentence.
|
|||
All letters "l" have been replaced by the letter "L". | |||
Code | <nowiki>
string.gsub("hello world","l","L")
</nowiki>
|
||
Output | heLLo worLd |
|
|||
It limits the substitutions to the first 2 letters found | |||
Code | <nowiki>
string.gsub("hello world","l","L",2)
</nowiki>
|
||
Output | heLLo world |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.