-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cBuffer] String Manipulation Helpers #72
Comments
Let's first implement this API into buffers. |
I realized these APIs should be implemented as a separate library because these does not depend on lev. |
+1 for not pulling this into the core. lua-nucleo has hard-tested and polished routines |
It might be smart to modify the string library and add these additions. Reopening for cBuffer support |
doesn't it contradict the initial goals? strings are generic lua, not fast and robust async io we've been trying to implement? |
@dvv thank-you for your comment. All IO will go through cBuffers and having some of these functions added to buffers is fine. As for strings, they are still useful in certain places and it might be good to add these methods to the standard string library. For example:
these are good functions to have because they only check the contents of memory -- there may be moments were it is important to use strings. |
I propose lev.string module.
It should be upper-compatible to lua's string module.
These are draft APIs for additional functions.
string.startsWith(s, prefix):boolean
string.endsWith(s, prefix):boolean
string.indexOf(s, predicate_func, startIndex):number or nil
string.lastIndexOf(s, predicate_func, startIndex):number or nil
string.ltrim(s, trimChars):string
string.rtrim(s, trimChars):string
string.trim(s, trimChars):string
string.lpad(s, resultLen, padding):string
string.rpad(s, resultLen, padding):string
The text was updated successfully, but these errors were encountered: