Index: lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as =================================================================== diff -u -r5b44cd0646c0ee06e57059948a5d5f730040f431 -r5402161894c885b6aa39fd5f86a12b854f377ffc --- lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision 5b44cd0646c0ee06e57059948a5d5f730040f431) +++ lams_flash/src/common/flash/org/lamsfoundation/lams/common/util/StringUtils.as (.../StringUtils.as) (revision 5402161894c885b6aa39fd5f86a12b854f377ffc) @@ -249,6 +249,38 @@ } /** + * Returns a new String based on the input String with the leading and trailing spaces removed + * @usage + * @param str + * @return + */ + public static function trim(str:String):String { + var startIdx:Number; + for (var i=0; i0; i--) { + if (str.charAt(i-1) != " ") { + endIdx = i; + break; + } + } + + // if there are no spaces, return a new instance of the original string, else return the trimmed string + if (startIdx == undefined || startIdx == null || endIdx == undefined || endIdx == null) { + if (str.length > 0) return new String(""); // string contains only spaces, return a new empty string + } + + var trimmedStr:String = str.substring(startIdx, endIdx); + return trimmedStr; + } + + /** * Checks to see if the value passed in is any of the null values defined in Config. * @usage * @param v