Get the left X characters from the string value passed. The code is setup to be included in a package titled "utils", change the package name on the declaration line to add it to any other package.
left
/** * Return the left number of characters specified in noChars from the string passed. * @param strValue {String} text to have left segment extracted * @param noChars - int - number of chars from the left to be extracted */ utils.left = function(strValue, noChars) { try { if (noChars <= 0) return ""; else if (noChars > strValue.length) return strValue; else return strValue.substring(0, noChars); } catch (e) { e = jsx3.NativeError.wrap(e); jsx3.log("util.left error: " + e.getMessage()); } }
