# Code Optimization

**URL:** https://forum.kirupa.com/t/code-optimization/221790
**Category:** flash
**Created:** [April 7, 2007, 8:16pm UTC](https://forum.kirupa.com/t/code-optimization/221790 "2007-04-07T20:16:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![igby](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/igby/32/2060_2.png) [@igby](https://forum.kirupa.com/u/igby)
#### Post date: [April 7, 2007, 8:16pm UTC](https://forum.kirupa.com/t/code-optimization/221790/1 "2007-04-07T20:16:07Z")

</div>

Hey all,

Is there a more efficient way to write this? Probably with a for loop, but I can’t seem to get it right.

[AS]  
var stripLine:Array = newStr[0].split("\_");  
if(stripLine.length \> 3) {  
description.text = stripLine[1]+" “+stripLine[2];  
} else if(stripLine.length \>4) {  
description.text = stripLine[1]+” “+stripLine[2]+” “+stripLine[3];  
} else if(stripLine.length \>5) {  
description.text = stripLine[1]+” “+stripLine[2]+” “+stripLine[3]+” “+stripLine[4];  
} else if(stripLine.length \>6 {  
description.text = stripLine[1]+” “+stripLine[2]+” “+stripLine[3]+” “+stripLine[4]+” “+stripLine[5];  
} else {  
description.text = stripLine[1]+” "+stripLine[2];  
}  
[/AS]

Thanks!

Igby
