SOLVED

String Length in Velocity Script?

Go to solution
Kai_Crow2
Level 2

String Length in Velocity Script?

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...

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: String Length in Velocity Script?

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

## do something

#end

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: String Length in Velocity Script?

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

## do something

#end

Kai_Crow2
Level 2

Re: String Length in Velocity Script?

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