[Home]
[Search]
[D]
succ(null); // returns null
succ("!@#$%"); // returns "!@#$%"
succ("1"); // returns "2"
succ("9"); // returns "10"
succ("999"); // returns "1000"
succ("zz99"); // returns "aaa00"
modifiers is a string of modifier characters:
| Modifier | Description |
|---|---|
| c | Complement the list of characters in from |
| d | Removes matching characters with no corresponding replacement in to |
| s | Removes adjacent duplicates in the replaced characters |
If modifier d is present, then the number of characters in to may be only 0 or 1.
If modifier d is not present and to is null, then to is taken to be the same as from.
If modifier d is not present and to is shorter than from, then to is extended by replicating the last character in to.
Both from and to may contain ranges using the - character, for example a-d is synonymous with abcd. Neither accept a leading ^ as meaning the complement of the string (use the c modifier for that).
Note: In the future, the pattern syntax may be improved to be more like regular expression character classes.
squeeze("hello goodbye") // returns "helo godbye"
squeeze("hello goodbye", "le") // returns "helo goodbye"