# Breaking a TextField into lines

**URL:** <https://forum.kirupa.com/t/breaking-a-textfield-into-lines/267616>\
**Category:** Uncategorized\
**Created:** [August 4, 2008, 4:00am UTC](https://forum.kirupa.com/t/breaking-a-textfield-into-lines/267616 "2008-08-04T04:00:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tibberous](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tibberous](https://forum.kirupa.com/u/tibberous)\
**Post date:** [August 4, 2008, 4:00am UTC](https://forum.kirupa.com/t/breaking-a-textfield-into-lines/267616/1 "2008-08-04T04:00:10Z")

</div>

Is there a proper way to break a multiline text field with wordwrap into lines?

Here is the hack I came up with:

```php

for(var i=0; line=tf.getLineText(0); i++){
	tf.text = tf.text.substr(line.length);
	lines* = line;
}

```

See, getLineText(1) is undefined, because since it word wrapped, it is technically 1 line line. Thanks to my near-god-like skills, I was able compensate, but I still wonder if there isn’t a better way. This way works fine, but doesn’t seem to work with htmlText.
