diff options
| author | ruki <[email protected]> | 2020-03-18 22:58:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-18 11:50:44 +0800 |
| commit | cf24293b75a34c610c619243eb3b43fc011b712f (patch) | |
| tree | 60137efd62be348d9b67a8c6f73ed6549cb80b8d /xmake/core/base/string.lua | |
| parent | c30c785e9d56d049c0b5f6a6657b93b96a1b8ea7 (diff) | |
improve string.lastof
Diffstat (limited to 'xmake/core/base/string.lua')
| -rw-r--r-- | xmake/core/base/string.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xmake/core/base/string.lua b/xmake/core/base/string.lua index 4a224b2c5..89d85672f 100644 --- a/xmake/core/base/string.lua +++ b/xmake/core/base/string.lua @@ -29,10 +29,16 @@ local serialize = require("base/serialize") string._dump = string._dump or string.dump string._trim = string._trim or string.trim string._split = string._split or string.split +string._lastof = string._lastof or string.lastof -- find the last substring with the given pattern function string:lastof(pattern, plain) + -- is plain text? use the native implementation + if plain then + return string._lastof(self, pattern) + end + -- find the last substring local curr = 0 repeat |
