# String Wizard Needed!

**URL:** <https://forum.kirupa.com/t/string-wizard-needed/176800>\
**Category:** flash\
**Created:** [January 27, 2006, 12:35am UTC](https://forum.kirupa.com/t/string-wizard-needed/176800 "2006-01-27T00:35:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [January 27, 2006, 12:35am UTC](https://forum.kirupa.com/t/string-wizard-needed/176800/1 "2006-01-27T00:35:39Z")

</div>

Is anyone smart enough to make a code that will take a string that is to be put into a dynamic textfield, and if the string is longer than 11 character make the textfield start a new line every time it sees a space in the string, unless the space is followed by ony one character?

i believe it will involve a

if(string.length \> 11){  
for(i=0; i \<string.length; i++){[INDENT]if(string.charAt(i) == " " && string.charAt(i+2) != " "){[INDENT][COLOR=Red]\*\*make the textfield start a new line!  
also set \_y -= 12  
break;  
\*\*[/COLOR] [/INDENT]}  
[/INDENT]}  
}

How do i make it start a new line when all these conditions are satisfied? There must be a way!
