Handlebars calculate string length after replace

Comments

4 comments

  • Official comment
    Lucian Hymer Senior Solutions Consultant

    Hey Hristina,

    I thought of a pretty nifty workaround that will work super well.

    We have a function called regexSearch which will compare a regular expression to a string and will return the index where the match starts. The regular expression "$" will match the end of the string. So if I just search for "$", it'll return the string length!

     

    P.S. I really like the two "Bob"s that you and I chose haha

    Thanks,
    -Lucian

  • Courtney Jordan Experience Strategy & Design Director Community moderator
    Celigo University Level 4: Legendary
    Awesome Follow-up
    Top Contributor

    Hi Hristina Bendeva,

    You should be able to use #compare handlebar to check the length of a string. Check this community post. Let us know if you have other questions or this doesn't solve your issue!

    0
  • Hristina Bendeva NetSuite Integration Whiz
    Awesome Follow-up
    Engaged
    Celigo University Level 4: Legendary

    Hi Courtney Jordan,

    This doesn't solve my issue because I need to remove the whitespaces from the string before I check the length of the string.

    0
  • Hristina Bendeva NetSuite Integration Whiz
    Awesome Follow-up
    Engaged
    Celigo University Level 4: Legendary

    Hi Lucian,

    Thank you for the solution this is what I needed.

     

    P.S both Bob's are legends in their own right.

    Thanks,

    -Hristina

    0

Please sign in to leave a comment.