function getElementChildrenByTag(xml:Element, tag:string) : Element[] { let l:Element[] = []; for(let i:number = 0;i=maxWidth) { if (last_space==0) { // a single word doesn't fit, just split it! lines.push(buffer); if (buffer.length>longestLine) longestLine = buffer.length; buffer = ""; } else { let backspaces:number = i - last_space; buffer = buffer.substring(0,buffer.length-backspaces); i-=backspaces; lines.push(buffer); if (buffer.length>longestLine) longestLine = buffer.length; buffer = ""; last_space = 0; } } } if (buffer != "") { lines.push(buffer); if (buffer.length>longestLine) longestLine = buffer.length; } return lines; } function allArrayElementsTrue(booleanArray:boolean[]) : boolean { for(let i:number = 0; i 0; i--) { let j:number = Math.floor(Math.random() * (i+1)); let tmp:any = list[i]; list[i] = list[j]; list[j] = tmp; } } function startsWith(str:string, prefix:string): boolean { return str.substring(0, prefix.length) == prefix; }