# String Length?

**URL:** https://www.finalbuilder.com/forums/t/string-length/4578
**Category:** Discussion
**Created:** [August 4, 2014, 10:15am UTC](https://www.finalbuilder.com/forums/t/string-length/4578 "2014-08-04T10:15:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jonathanmeltzer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jonathanmeltzer](https://www.finalbuilder.com/forums/u/jonathanmeltzer)
#### Post date: [August 4, 2014, 10:15am UTC](https://www.finalbuilder.com/forums/t/string-length/4578/1 "2014-08-04T10:15:57Z")

</div>

Is there a way to get the length of a string? &nbsp;I want to get the length of a string so that I can replace the characters for that string with the equivalent number of spaces in a larger string. &nbsp;As an example: &nbsp;My have a string that says “Lead: %LeadString% Resource: %Resource%”. &nbsp;When one line has the same %LeadString% value as the previous line, I want to replace “Lead: %LeadString%” with spaces in the second line. &nbsp; Of course, %LeadString% can vary in length, so I need to get the length of it before I can replace it.  
  
I cannot figure out a way to do it, though.

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [August 5, 2014, 1:26am UTC](https://www.finalbuilder.com/forums/t/string-length/4578/2 "2014-08-05T01:26:47Z")

</div>

Hi Jonathan,   
  
 Thanks for contacting us.   
  
 Good news on the issue your seeing. This can be done in javascript through the scripting on the actions, or a script actions.   
  
 The javascript to get a variable length is simply to use the “length” function off any string. This will return the length of that string which you can assign to a variable. The code for this is like so;   
  
 FBVariables.MyVariableLength = FBVariables.Blah.length;   
  
 You can place this javascript into any script event. The value will be available after the script event has run.

---

<div class="post-metadata">

### Author: ![jonathanmeltzer](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jonathanmeltzer](https://www.finalbuilder.com/forums/u/jonathanmeltzer)
#### Post date: [August 14, 2014, 5:12am UTC](https://www.finalbuilder.com/forums/t/string-length/4578/3 "2014-08-14T05:12:46Z")

</div>

Thank you for this solution. This actually opened up the door to how to use the scripting, and that is proving to be very useful.
