# .split() problem

**URL:** <https://forum.kirupa.com/t/split-problem/254658>\
**Category:** flash\
**Created:** [March 13, 2008, 10:07pm UTC](https://forum.kirupa.com/t/split-problem/254658 "2008-03-13T22:07:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![munklemoose](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@munklemoose](https://forum.kirupa.com/u/munklemoose)\
**Post date:** [March 13, 2008, 10:07pm UTC](https://forum.kirupa.com/t/split-problem/254658/1 "2008-03-13T22:07:44Z")

</div>

hi,

Im having a bit of bother with this one. I have a flash file which loads in vars from director. It then adds the values to a graph. The amounts from the string are inputed into text fields. the fields are named energy, waste etc. I want a textfield to output whichever sections that are over 5 saying "well done, you have excelled in water, energy… I have got this working but am stuck on this bit: I am wanting to add an “and” before the last item, so it outputs as “well done you have excelled in water, waste and energy”. Also if only one item is over 5 it wont add the “and”. This probably doesnt make any sense, heres my code anyhow:

```auto

var summary_results = "2000,6,3,10,8,6";

var txtFields:Array = [Total,Energy,Waste,Water,Food,Transport];
var excelledItems:Array = []; 

var theValues:Array = summary_results.split(",");

for(var i=1;i<theValues.length;i++){     
    theValues* = Number(theValues*);     
    txtFields*.text = theValues*;
    
    if(theValues* >= 5){
        theValues* == txtFields*;
        excelledItems.push(" " + txtFields*._name);
        if(excelledItems.length > 1){
            //add an "and" somehow....
        }
    }
}

//well done text
wellDone = "Well Done! 

You have excelled in"+ excelledItems +". You know these Eco topics well!";

stop();

```
