.shivanshi.
. Home . Share . Share Success . Join Us! .

ActionScript - Code Samples

Arrays

Manipulate arrays as you want.

//Trim a string:
trim = function(txt_str) {
	while (txt_str.charAt(0) == " ") {
		txt_str = txt_str.substring(1, txt_str.length);
	}
	while (txt_str.charAt(txt_str.length-1) == " ") {
		txt_str = txt_str.substring(0, txt_str.length-1);
	}
	// trace(txt_str);
	return txt_str;
};


//Trim new line characters:
trimNewline = function(text_str) {
	var temp_array = text_str.split(chr(13)+chr(10));
	var temp1_array = [];
	for (i=0; i < temp_array.length; i++) {
		if (trim(temp_array[i]) != "") {
			temp1_array.push(trim(temp_array[i]));
		}
	}
	var new_str = temp1_array.join(" ");
	return new_str;
};
Add Favorite
| About Us | Site Map | Privacy Policy | Contact Us |
.shivanshi.