1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1 1 53 53 53 53 89 89 89 89 1011 50 50 50 53 1 | define(['../lang/toString', './WHITE_SPACES'], function(toString, WHITE_SPACES){ /** * Remove chars from end of string. */ function rtrim(str, chars) { str = toString(str); chars = chars || WHITE_SPACES; var end = str.length - 1, charLen = chars.length, found = true, i, c; while (found && end >= 0) { found = false; i = -1; c = str.charAt(end); while (++i < charLen) { if (c === chars[i]) { found = true; end--; break; } } } return (end >= 0) ? str.substring(0, end + 1) : ''; } return rtrim; }); |