From 25cf8f48bb37ea7e94a5e9c4d6ec3c8fc1b92ddd Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 27 Nov 2020 14:39:29 -0500 Subject: [PATCH] Improve substr examples --- content/en/functions/substr.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/content/en/functions/substr.md b/content/en/functions/substr.md index feb25aa1b..7253c97d4 100644 --- a/content/en/functions/substr.md +++ b/content/en/functions/substr.md @@ -26,6 +26,18 @@ To extract characters from the end of the string, use a negative start number. In addition, borrowing from the extended behavior described at https://php.net substr, if `length` is given and is negative, that number of characters will be omitted from the end of string. ``` -{{substr "BatMan" 0 -3}} → "Bat" -{{substr "BatMan" 3 3}} → "Man" +{{ substr "BatMan" 0 3 }} → "Bat" +{{ substr "BatMan" 3 3 }} → "Man" + +{{ substr "BatMan" 0 }} → "BatMan" +{{ substr "BatMan" 1 }} → "atMan" + +{{ substr "BatMan" 0 -1 }} → "BatMa" +{{ substr "BatMan" 3 -1 }} → "Ma" + +{{ substr "BatMan" -3 1 }} → "M" +{{ substr "BatMan" -3 3 }} → "atM" + +{{ substr "BatMan" -4 -1 }} → "tMa" +{{ substr "BatMan" -4 -2 }} → "tM" ```