Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge: lib/core: add Text::prefix and Text::suffix
I wanted a way to detect and possibly remove a prefix from a string but there was no straight-forward way. So I propose one: ~~~ var str = "hello world" var p = str.prefix("hello") assert p != null and p.text_after == " world" assert str.prefix("fail") == null ~~~ Same with `suffix` Pull-Request: #1829 Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 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