String Length in Velocity Script? | Community
Skip to main content
Kai_Crow2
Level 2
February 13, 2019
Solved

String Length in Velocity Script?

  • February 13, 2019
  • 1 reply
  • 15695 views

Is there a way to return the length of a string in Marketo Velocity email script? I might just be being dumb, but I've tried looking and can't find it referenced anywhere.

I want to have a script token display a different format greeting if we've just been given a single initial for first name (as we often get this occurring) - I can think of a few ways of using several lines of code to achieve this, but would rather not create something unnecessarily complex for what seems simple if I can avoid it...

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

#if( $lead.SomeField.length().equals(1) )

## do something

#end

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
February 13, 2019

#if( $lead.SomeField.length().equals(1) )

## do something

#end

Kai_Crow2
Kai_Crow2Author
Level 2
February 13, 2019

THANK YOU! Yes - I knew there had to be a simple solution. Don't know why I couldn't find that...