Using String-Length to determine length of block

Modified on Thu, Feb 8, 2018 at 2:10 PM

If you want to determine the length of a block so that you can change what happens within a paragraph.

The following will check if the Email Block is greater than 29 characters.

!!if string-length("{Email}")>29%%<horizscaling=90% charspacing=-10>!!

The following will add what is in first name and last name and credentials together:

!!if (string-length("{First Name}") + string-length("{Last Name}") + string-length("{Credentials}")) >= 28 %%Do something like put a next line!!

IMPORTANT POINT

When you calculate string-length you must take into account if you put a postfix of something. so for example if you have a nextline in a name block. when you calculate the number of character you must take into account 10 for <nextline>. 

So if my number is 17 in order to change the horizscaling i must make the number 27 to include the <nextline> that is part of the postfix. Anything that is part of the postfix or prefix should be included in the string-length

The following will see if first plus last plus credentials is longer than x amount of characters and if so put a <nextline> otherwise put a comma.

<avoidbreak>{First Name} {Last Name}!!if (string-length("{First Name}") + string-length("{Last Name}") + string-length("{Credentials}")) >= 28 and "{Credentials or Designations}" !=""%%<nextline>!!!!if (string-length("{First Name}") + string-length("{Last Name}") + string-length("{Credentials}")) < 28 and "{Credentials}" !=""%%, !!{Credentials}<nextline>

 

 

 

<avoidbreak>{First Name (& Initial)} {Last Name}!!if (string-length("{First Name (& Initial)}") + string-length("{Last Name}") + string-length("{Credentials or Designations}")) >= 28 and "{Credentials or Designations}" !=""%%<nextline><fontname=FrutigerLTStd-Light encoding=winansi>!!!!if (string-length("{First Name (& Initial)}") + string-length("{Last Name}") + string-length("{Credentials or Designations}")) < 28 and "{Credentials or Designations}" !=""%%<fontname=FrutigerLTStd-Light encoding=winansi>, !!{Credentials or Designations}<nextline

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article