StringUtil.trimEnd()
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5215 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,11 +21,11 @@
|
||||
|
||||
package com.threerings.util {
|
||||
|
||||
import com.threerings.util.env.Environment;
|
||||
|
||||
import flash.utils.ByteArray;
|
||||
import flash.utils.Dictionary;
|
||||
|
||||
import com.threerings.util.env.Environment;
|
||||
|
||||
public class StringUtil
|
||||
{
|
||||
/**
|
||||
@@ -237,7 +237,7 @@ public class StringUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function that strips whitespace from the ends of a String.
|
||||
* Utility function that strips whitespace from the beginning and end of a String.
|
||||
*/
|
||||
public static function trim (str :String) :String
|
||||
{
|
||||
@@ -256,6 +256,19 @@ public class StringUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function that strips whitespace from the end of a String.
|
||||
*/
|
||||
public static function trimEnd (str :String) :String
|
||||
{
|
||||
var endIdx :int = str.length - 1;
|
||||
while (isWhitespace(str.charAt(endIdx))) {
|
||||
endIdx--;
|
||||
}
|
||||
|
||||
return (endIdx >= 0 ? str.slice(0, endIdx + 1) : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the specified String is == to a single whitespace character.
|
||||
*/
|
||||
@@ -493,7 +506,7 @@ public class StringUtil
|
||||
str += "\n";
|
||||
}
|
||||
return str;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user