<$ function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function isNull(obj) { return obj === undefined || obj == null || !obj || 0 === obj.length; } String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; String.format = function(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; // // var vbCrLf = "\r\n"; // // function less(lessString) { // return _context.Less(lessString); // } // // function HtmlEncode(obj){ // return system.htmlEncode(obj); // } // // // helps convert some ZP string values to a bool. // function IsTrue(obj){ // return (obj == "True" || obj === true || obj == 1 ); // } // // // Prüfen, ob leer. // function IsEmpty(str) { // return (!str || 0 === str.length); // } // // // Prüfen, ob leer oder nur Whitespaces enthalten. // function IsBlank(str) { // return (!str || /^\s*$/.test(str)); // } // // // Prüfen, ob leer. // String.prototype.IsEmpty = function() { // return (this.length === 0 || !this.trim()); // }; // // // Prüfen ob NULL oder undefined. // function isNull(obj) { // return obj === undefined || obj == null || !obj // } // // // Eigene Format-Funktion. // // Beispiel: "Dies ist {0} Test.".Format("ein"); // if (!String.prototype.Format) { // String.prototype.Format = function() { // var args = arguments; // return this.replace(/{(\d+)}/g, function(match, number) { // return typeof args[number] != 'undefined' // ? args[number] // : match // ; // }); // }; // } // // // Alternative Schreibweise für Format-Funktion. // // Beispiel: String.Format("Dies ist {0} Test.", "ein"); // if (!String.Format) { // String.Format = function(format) { // var args = Array.prototype.slice.call(arguments, 1); // return format.replace(/{(\d+)}/g, function(match, number) { // return typeof args[number] != 'undefined' // ? args[number] // : match // ; // }); // }; // } // // /* // // HTML-Attribut ausgeben, nur wenn auch Inhalt hat. // function htmlAttr(attrName, attrValue) { // if ( IsBlank(attrValue) ) { // return ""; // } else { // return '{0}="{1}"'.Format( attrName, attrValue ); // } // } // // // HTML-Attribut ausgeben wenn condition == true. // function htmlAttrIf(condition, attrName, attrValue) { // if ( ! IsTrue(condition) ) { // return ""; // } else { // return htmlAttr(attrName, attrValue); // } // } // */ // // // Ersatz für die VBSkript isNumeric Funktion -> http://stackoverflow.com/questions/18082/validate-decimal-numbers-in-javascript-isnumeric // function isNumeric(n) { // return !isNaN(parseFloat(n)) && isFinite(n); // } // // // Einfacher Ersatz für VBScript Replace() - die "count" und "compare" Parameter von VBScript werden nicht unterstützt! // function Replace(searchstring, find, replace) { // return searchstring.replace(find, replace); // } // // // diverse String helper. Quelle: http://www.4guysfromrolla.com/webtech/vb2java.shtml // function Left(str, n) { // if (n <= 0){ // Invalid bound, return blank string // return ""; // } // else if (n > String(str).length){ // Invalid bound, return // return str; // entire string // } // else { // Valid bound, return appropriate substring // return String(str).substring(0,n); // } // } // // function Right(str, n) { // if (n <= 0){ // Invalid bound, return blank string // return ""; // } // else if (n > String(str).length){ // Invalid bound, return // return str; // entire string // } // else { // Valid bound, return appropriate substring // var iLen = String(str).length; // return String(str).substring(iLen, iLen - n); // } // } // // function Mid(str, start, len) { // // this is using ONE-Based strongs to mimic vbscript! // // // Make sure start and len are within proper bounds // if (start <= 0 || len < 0){ // return ""; // } // // var iEnd, iLen = String(str).length; // if (start + len > iLen){ // iEnd = iLen; // } // else { // iEnd = (start - 1) + len; // } // return String(str).substring(start-1,iEnd); // } // $>