Advanced PDF Template tags

We have different types of keep tags that will be used for the PDF template formatting.

  1. keep_after
  2. keep_after_last
  3. keep_before
  4. keep_before_last
keep_after
It removes the part of the string that is not after the first occurrence of the given substring.
Example: 
${"abcdefgh"?keep_after("de")}

Output :
fgh

keep_after_last

It is same as keep after, but keeps the part after the last occurrence of the parameter, rather than after the first. 
Example:
${"foo.bar.txt"?keep_after_last(".")}

output:
txt

Note: If we use the keep_after tag then we will get the output "bar.txt."

keep_before

Removes the part of the string that starts with the given substring.
Example:
${"abcdef"?keep_before("de")}

Output:
abc

keep_before_last

It is also same as keep_before but keeps the part before the last occurrence of the parameter, rather than after the first.
Example:
${"foo.bar.txt"?keep_before_last(".")}

output:
foo.bar
If we use the keep before tag then we will get the output as foo

Leave a comment

Your email address will not be published. Required fields are marked *