Welcome to MoiK78 blog. Your daily intake of Internet news. This is a personal site so I post whenever I can :) but I'll try to get it daily. Be free to email me any suggestion. El bolg de Moisés García sobre tecnologías de internet y programas de diseño.
Homepage About Me Contact Me Buy at MoiK78 online shop Downloads

Welcome to MoiK78 blog, your daily intake of internet and technology news.

Picasa Web Albums My Picasa Photo Albums / Albumes de Fotos

November 08, 2002

More String Methods.
The first one checks if the string is empty, it consider blank spaces as the string is empty
String.prototype.IsEmpty = function () {
var temp = this.toString();
for (var i=0; i < temp.length; i++) {
if (temp.substr(i, 1) !=("" || " ")) {
return false;
return true;

myString = new String(" ");
if (myString.IsEmpty()) {
trace("String is empty");
} else {
trace("String not empty");

One more, this one clears those annoying newlines when you load text from a .txt
String.prototype.ClearNewLines = function () {
var start = 0
var temp= this.toString();
for (var i=0; i < temp.length/2; i++) {
var pointer = temp.indexOf("\n",start);
var output = output + temp.slice(start, pointer);
start = pointer + 1
if (pointer == -1) {
return output;

Site Meter