Skip to content

Commit 79ff206

Browse files
committed
Add quote and reverse functions to docs
1 parent 03d0a36 commit 79ff206

File tree

1 file changed

+27
-0
lines changed
  • extensions/src/main/java/dev/cel/extensions

1 file changed

+27
-0
lines changed

extensions/src/main/java/dev/cel/extensions/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,19 @@ Examples:
474474
'TacoCat'.lowerAscii() // returns 'tacocat'
475475
'TacoCÆt Xii'.lowerAscii() // returns 'tacocÆt xii'
476476

477+
### Quote
478+
479+
Takes the given string and makes it safe to print (without any formatting due
480+
to escape sequences).
481+
If any invalid UTF-8 characters are encountered, they are replaced with \uFFFD.
482+
483+
strings.quote(<string>)
484+
485+
Examples:
486+
487+
strings.quote('single-quote with "double quote"') // returns '"single-quote with \"double quote\""'
488+
strings.quote("two escape sequences \a\n") // returns '"two escape sequences \\a\\n"'
489+
477490
### Replace
478491

479492
Returns a new string based on the target, which replaces the occurrences of a
@@ -493,6 +506,20 @@ Examples:
493506
'hello hello'.replace('he', 'we', 1) // returns 'wello hello'
494507
'hello hello'.replace('he', 'we', 0) // returns 'hello hello'
495508

509+
### Reverse
510+
511+
Returns a new string whose characters are the same as the target string, only
512+
formatted in reverse order.
513+
This function relies on converting strings to Unicode code point arrays in
514+
order to reverse.
515+
516+
<string>.reverse() -> <string>
517+
518+
Examples:
519+
520+
'gums'.reverse() // returns 'smug'
521+
'John Smith'.reverse() // returns 'htimS nhoJ'
522+
496523
### Split
497524

498525
Returns a mutable list of strings split from the input by the given separator. The

0 commit comments

Comments
 (0)