添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
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 Fotiou. Actually starts with and ends with returns true/ false. I have to return redblue as per above example – Shruti sharma May 20, 2020 at 8:02 @ShrutiSharma There's no shorthand for that, you have to use #if then. Or, you can write a macro to do this if this is needed very often. – ddekany May 20, 2020 at 15:01

    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.