Cheaper string.Trim* functions for E2#3626
Conversation
I took some code from Starfall to make the regex check less strict
|
Didn't you have an even faster implementation with string.byte? These funcs don't have a pattern matching input so you could use the string.byte one. |
|
Yes, but i only made them for string.Trim and string.TrimRight, so i decided to force all functions to use patterns for consistency, but i can probably just write a custom implementation for string.TrimLeft as well? |
|
TrimLeft and TrimRight are the same as Trim except they only search one side, so yeah it should be easy to just have two local functions that search the left/right and then just function string.Trim(s) return string.sub(s, findLeftTrim(s), findRightTrim(s)) end |
I took some code from Starfall to make the regex check less strict