| Package | vegas.util |
| Class | public class StringUtil |
StringUtil utility class is an extended String class with methods for working with string.
This class complete the system.Strings static class.
| Method | Defined by | ||
|---|---|---|---|
|
clone(s:String):String
[static]
Returns a shallow copy of the specified string.
| StringUtil | ||
|
copy(str:String):String
[static]
Returns a copy by value of this object.
| StringUtil | ||
|
firstChar(str:String):String
[static]
Determines whether the start of this instance matches the specified String.
| StringUtil | ||
|
isEmpty(str:String):Boolean
[static]
Returns
true if this string is empty. | StringUtil | ||
|
lastChar(str:String):String
[static]
Returns the last char of the string.
| StringUtil | ||
|
lastIndexOfAny(str:String, ar:Array):int
[static]
Reports the index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
| StringUtil | ||
|
repeat(str:String = "", count:uint = 0):String
[static]
Returns a new String value who contains the specified String characters repeated count times.
| StringUtil | ||
|
replace(str:String, search:String, replace:String):String
[static]
Replaces the 'search' string with the 'replace' String.
| StringUtil | ||
|
reverse(str:String):String
[static]
Reverses the current instance.
| StringUtil | ||
|
splice(str:String, startIndex:uint, deleteCount:uint = 0, value:* = null):String
[static]
Adds and removes elements in the string.
| StringUtil | ||
|
toArray(str:String, separator:String = ""):Array
[static]
Returns an array representation of this instance.
| StringUtil | ||
|
toSource(str:String, ... rest):String
[static]
Returns the eden representation of the object.
| StringUtil | ||
|
ucFirst(str:String):String
[static]
Returns the value of this specified string with the first character in uppercase.
| StringUtil | ||
|
ucWords(str:String):String
[static]
Uppercases the first character of each word in a string.
| StringUtil | ||
| Constant | Defined by | ||
|---|---|---|---|
| EMPTY : String = "" [static]
Represents the empty string.
| StringUtil | ||
| SPC : String = " " [static]
Represents the space string value.
| StringUtil | ||
| clone | () | method |
public static function clone(s:String):StringReturns a shallow copy of the specified string.
Parameterss:String |
String — a shallow copy of the specified string.
|
| copy | () | method |
public static function copy(str:String):StringReturns a copy by value of this object.
Parametersstr:String |
String — a copy by value of this object.
|
| firstChar | () | method |
public static function firstChar(str:String):StringDetermines whether the start of this instance matches the specified String.
Parametersstr:String |
String |
| isEmpty | () | method |
public static function isEmpty(str:String):Boolean
Returns true if this string is empty.
Example :
import vegas.util.StringUtil ;
var b1:Boolean = StringUtil.isEmpty("") ; // true
var b2:Boolean = StringUtil.isEmpty("hello world") ; // false
Parameters
str:String — the string object.
|
Boolean — true if this string is empty.
|
| lastChar | () | method |
public static function lastChar(str:String):StringReturns the last char of the string.
Example :
import vegas.util.StringUtil ;
trace( StringUtil.lastChar("hello world") ; // d
Parameters
str:String — the string object.
|
String — the last char of the string.
|
| lastIndexOfAny | () | method |
public static function lastIndexOfAny(str:String, ar:Array):intReports the index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
Parametersstr:String |
|
ar:Array |
int — the index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
|
| repeat | () | method |
public static function repeat(str:String = "", count:uint = 0):StringReturns a new String value who contains the specified String characters repeated count times.
Example :
import vegas.util.StringUtil ;
trace(StringUtil.repeat("hello", 0)) ; // hello
trace(StringUtil.repeat("hello", 3)) ; // hellohellohello
Parameters
str:String (default = "") |
|
count:uint (default = 0) |
String — a new String value who contains the specified String characters repeated count times.
|
| replace | () | method |
public static function replace(str:String, search:String, replace:String):StringReplaces the 'search' string with the 'replace' String.
Example :
vegas.util.StringUtil.replace("hello world", "hello", "hi") ; // "hello world" -> "hi world"
Parameters
str:String — string to transform.
|
|
search:String |
|
replace:String |
String — the new string transform with this method.
|
| reverse | () | method |
public static function reverse(str:String):StringReverses the current instance.
Example :
var reverse:String = vegas.util.StringUtil.reverse("hello") ; // "olleh"
Parameters
str:String |
String — the reverse string of the specified string passed-in argument.
|
| splice | () | method |
public static function splice(str:String, startIndex:uint, deleteCount:uint = 0, value:* = null):StringAdds and removes elements in the string.
Parametersstr:String — Index at which to start changing the string.
|
|
startIndex:uint — Indicating the number of old character elements to remove.
|
|
deleteCount:uint (default = 0) — The elements to add to the string. If you don't specify any elements, splice simply removes elements from the string.
|
|
value:* (default = null) |
String |
import vegas.util.StringUtil ;
var result:String ;
result = StringUtil.splice("hello world", 0, 1, "H") ;
trace(result) ; // Hello world
result = StringUtil.splice("hello world", 6, 0, "life") ;
trace(result) ; // hello lifeworld
result = StringUtil.splice("hello world", 6, 5, "life") ;
trace(result) ; // hello life
| toArray | () | method |
public static function toArray(str:String, separator:String = ""):ArrayReturns an array representation of this instance.
Example :
import vegas.util.StringUtil ;
trace( StringUtil.toArray("hello world" )) ; // h,e,l,l,o, ,w,o,r,l,d
Parameters
str:String |
|
separator:String (default = "") |
Array — an array representation of this instance.
|
| toSource | () | method |
public static function toSource(str:String, ... rest):StringReturns the eden representation of the object.
Parametersstr:String |
|
... rest |
String — a string representing the source code of the object.
|
import vegas.util.StringUtil ;
var source:String = StringUtil.toSource("hello world") ;
trace(source) ; // "hello world"
| ucFirst | () | method |
public static function ucFirst(str:String):StringReturns the value of this specified string with the first character in uppercase.
Example :
import vegas.util.StringUtil ;
trace( StringUtil.ucFirst("hello world" )) ; // Hello world
Parameters
str:String |
String — the value of this string with the first character in uppercase.
|
| ucWords | () | method |
public static function ucWords(str:String):StringUppercases the first character of each word in a string.
Example :
import vegas.util.StringUtil ;
trace( StringUtil.ucWords("hello world" )) ; // Hello World
Parameters
str:String |
String — the string value with the first character in uppercase of each word in a string.
|
| EMPTY | constant |
public static const EMPTY:String = ""Represents the empty string. This property should be read-only.
| SPC | constant |
public static const SPC:String = " "Represents the space string value.