ExtensionMethod.NET Home of 820 C#, Visual Basic, F# and Javascript extension methods

IsFilled(), IsEmpty()

Returns if a string is null or empty

Source

String.prototype.IsFilled = function () {
    if (this && this.length > 0) {
        return true;
    }
    return false;
}
 
String.prototype.IsEmpty = function () {
    return !this.IsFilled();
}

Example

return filter.IsFilled();

Author: Loek van den Ouweland

Submitted on: 24 okt 2012

Language: JavaScript

Type: String

Views: 4883