-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: add some string related Lua functions
- Loading branch information
1 parent
99af12a
commit 8f92581
Showing
10 changed files
with
98 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
--- myMPD string functions | ||
--- | ||
|
||
--- Trims a string | ||
-- @param str String to trim | ||
-- @return Trimed string | ||
function mympd.trim(str) | ||
return (string.gsub(str, "^%s*(.-)%s*$", "%1")) | ||
end | ||
|
||
--- Split string by newline characters and trims the lines | ||
-- @param str String to split | ||
-- @return tables of lines | ||
function mympd.splitlines(str) | ||
local lines = {} | ||
for line in string.gmatch(str, "[^\n]+") do | ||
line = mympd.trim(line) | ||
table.insert(lines, line) | ||
end | ||
return lines | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: String Functions | ||
--- | ||
|
||
Some useful string handling functions. | ||
|
||
## Splitting strings | ||
|
||
Split string by newline characters and trims the lines. | ||
|
||
```lua | ||
local lines = mympd.splitlines(str) | ||
``` | ||
|
||
**Parameters:** | ||
|
||
| PARAMETER | TYPE | DESCRIPTION | | ||
| --------- | ---- | ----------- | | ||
| str | string | Multiline string to split. | | ||
|
||
## Triming strings | ||
|
||
Removes beginning and ending whitespaces from a string. | ||
|
||
```lua | ||
local trimed = mympd.trim(str) | ||
``` | ||
|
||
**Parameters:** | ||
|
||
| PARAMETER | TYPE | DESCRIPTION | | ||
| --------- | ---- | ----------- | | ||
| str | string | String to trim. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
- bg-BG: 1083 missing phrases | ||
- es-AR: fully translated | ||
- es-ES: 950 missing phrases | ||
- es-VE: 938 missing phrases | ||
- fi-FI: 935 missing phrases | ||
- fr-FR: fully translated | ||
- it-IT: fully translated | ||
- ja-JP: fully translated | ||
- ko-KR: fully translated | ||
- nl-NL: fully translated | ||
- pl-PL: 83 missing phrases | ||
- ru-RU: 31 missing phrases | ||
- zh-Hans: fully translated | ||
- zh-Hant: 117 missing phrases | ||
- bg-BG: 1085 missing phrases | ||
- es-AR: 2 missing phrases | ||
- es-ES: 952 missing phrases | ||
- es-VE: 940 missing phrases | ||
- fi-FI: 937 missing phrases | ||
- fr-FR: 2 missing phrases | ||
- it-IT: 2 missing phrases | ||
- ja-JP: 2 missing phrases | ||
- ko-KR: 2 missing phrases | ||
- nl-NL: 2 missing phrases | ||
- pl-PL: 85 missing phrases | ||
- ru-RU: 33 missing phrases | ||
- zh-Hans: 2 missing phrases | ||
- zh-Hant: 119 missing phrases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters