Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
How to check whether particular
string
starts with
hello or
ends with
Hello or
contains
hello in
apache free marker
. is there any predefined
function
available
HelloIamShruti
IamShrutiHello
ShrutiHelloSharma
If i want to check starts with "Hello" first string should be returned
If i want to check ends with "Hello" second string should be returned
If i want to check contains "Hello" last string should be returned
starts_with, ex. "redblue"?starts_with("red")
will return true.
ends_with, ex. "redblue"?ends_with("red")
will return false.
contains, ex. <#if "piceous"?contains("ice")>It contains "ice"</#if>
will show the message
When you want the word to be contained but not in the start or the end, just add an if condition to check if starts_with
and ends_with
result to false.
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.