| Constant | Defined By | ||
|---|---|---|---|
| camelCase : Function
Converts a hyphenated string to a camelcased string. | core.strings | ||
| capitalize : Function
Converts the first letter of each word in a string to uppercase. | core.strings | ||
| center : Function
Returns the center string representation of the specified string value. | core.strings | ||
| clean : Function
Removes all extraneous whitespace from a string and trims it. | core.strings | ||
| compare : Function
Compares two strings. | core.strings | ||
| endsWith : Function
Determines wether the end of a string matches the specified value. | core.strings | ||
| fastformat : Function
Quick and fast format of a string using indexed parameters only. | core.strings | ||
| format : Function
Format a string using indexed or named parameters. | core.strings | ||
| hyphenate : Function
Converts a camelcased string to a hyphenated string. | core.strings | ||
| indexOfAny : Function
Reports the index of the first occurrence in this instance of any character in a specified array of Unicode characters. | core.strings | ||
| insert : Function
Inserts a specified instance of String at a specified index position in this instance. | core.strings | ||
| lastIndexOfAny : Function
Reports the index position of the last occurrence in this instance of one or more characters specified in a Unicode array. | core.strings | ||
| lineTerminatorChars : Array
Like white space characters, line terminator characters are used to improve source text readability and to separate tokens (indivisible lexical units) from each other. | core.strings | ||
| pad : Function
Apply character padding to a string. | core.strings | ||
| padLeft : Function
Right-aligns the characters in this instance, padding on the left with a specified Unicode character for a specified total length. | core.strings | ||
| padRight : Function
Left-aligns the characters in this string, padding on the right with a specified Unicode character, for a specified total length. | core.strings | ||
| repeat : Function
Returns a new String value who contains the specified String characters repeated count times. | core.strings | ||
| startsWith : Function
Checks if this string starts with the specified prefix. | core.strings | ||
| trim : Function
Removes all occurrences of a set of specified characters (or strings) from the beginning and end of this instance. | core.strings | ||
| trimEnd : Function
Removes all occurrences of a set of characters specified in an array from the end of this instance. | core.strings | ||
| trimStart : Function
Removes all occurrences of a set of characters specified in an array from the beginning of this instance. | core.strings | ||
| userAgent : Function
Returns a user-agent string. | core.strings | ||
| whiteSpaceChars : Array
Contains all white space chars. | core.strings | ||
| camelCase | Constant |
public const camelCase:FunctionConverts a hyphenated string to a camelcased string.
Example :
import core.strings.camelCase ;
trace( camelCase("hello-world" ) ) ; // helloWorld
| capitalize | Constant |
public const capitalize:FunctionConverts the first letter of each word in a string to uppercase.
Example :
import core.strings.capitalize ;
trace( capitalize( "hello world" ) ) ; // Hello World
| center | Constant |
public const center:FunctionReturns the center string representation of the specified string value.
Example :
import core.strings.center ;
trace( center("hello world", 0) ) ; // hello world
trace( center("hello world", 20) ) ; // hello world
trace( center("hello world", 20, "_" ) ) ; // ____hello world_____
| clean | Constant |
public const clean:FunctionRemoves all extraneous whitespace from a string and trims it.
Example :
import core.strings.clean ;
trace( clean(" hello world \n\n" ) ) ; // hello world
| compare | Constant |
public const compare:FunctionCompares two strings.
The default comparaison algorithm use an ascending alphabetic order with minuscule weighting less than majuscule.
return :
basic usage
var s0:String = "HELLO";
var s1:String = "hello";
var s2:String = "welcome";
var s3:String = "world";
trace( compare( s1, s2 ) ); //-1
trace( compare( s2, s1 ) ); //1
trace( compare( s1, s3 ) ); //1
trace( compare( s1, s1 ) ); //0
trace( compare( s1, s0 ) ); //0
trace( compare( s1, s0, true ) ); //-1
trace( compare( s0, s1, true ) ); //1
| endsWith | Constant |
public const endsWith:FunctionDetermines wether the end of a string matches the specified value.
import core.strings.endsWith ;
trace( endsWith( "hello world", "world" ) ); //true
trace( endsWith( "hello world", "hello" ) ); //false
trace( endsWith( "hello.txt" , "txt" ) ) ; // true
| fastformat | Constant |
public const fastformat:FunctionQuick and fast format of a string using indexed parameters only.
Usage :
fastformat( pattern:String, ...args:Array ):Stringfastformat( pattern:String, [arg0:arg1:arg2: ...] ):StringSee also
import core.strings.fastformat;
trace( fastformat( "hello {0}", "world" ) );
//output: "hello world"
trace( fastformat( "hello {0} {1} {2}", [ "the", "big", "world" ] ) );
//output: "hello the big world"
| format | Constant |
public const format:FunctionFormat a string using indexed or named parameters.
Usage :
format( pattern:String, ...args:Array ):Stringformat( pattern:String, [arg0:arg1:arg2: ...] ):Stringformat( pattern:String, [arg0:arg1:arg2: ...], ...args:Array ):Stringformat( pattern:String, {name0:value0,name1:value1,name2:value2, ...} ):Stringformat( pattern:String, {name0:value0,name1:value1,name2:value2, ...}, ...args:Array ):StringError — When a token is malformed.
|
See also
import core.strings.format ;
trace( format( "{0},{1},{2}" , "apples" , "oranges", "grapes" ) ) ; // apples,oranges,grapes
trace( format( "{0},{1},{2}" , ["apples" , "oranges", "grapes"] ) ) ; // apples,oranges,grapes
trace( format( "{path}{0}{name}{1}" , { name : "format" , path:"core.strings" } , "." , "()" ) ) ; // core.strings.format()
| hyphenate | Constant |
public const hyphenate:FunctionConverts a camelcased string to a hyphenated string.
import core.strings.hyphenate ;
trace( hyphenate( "helloWorld" ) ) ; //"hello-world"
| indexOfAny | Constant |
public const indexOfAny:FunctionReports the index of the first occurrence in this instance of any character in a specified array of Unicode characters.
import core.strings.indexOfAny ;
var result:int ;
result = indexOfAny("hello world", [2, "hello", 5]) ;
trace( result ) ; // 0
result = indexOfAny("Five = 5", [2, "hello", 5]) ;
trace( result ) ; // 2
result = indexOfAny("actionscript is good", [2, "hello", 5]) ;
trace( result ) ; // -1
| insert | Constant |
public const insert:FunctionInserts a specified instance of String at a specified index position in this instance.
note :
if index is null, we directly append the value to the end of the string. if index is zero, we directly insert it to the begining of the string.Example :
import core.strings.insert ;
var result:String;
result = insert("hello", 0, "a" ); // ahello
trace(result) ;
result = insert("hello", -1, "a" ); // hellao
trace(result) ;
result = insert("hello", 10, "a" ); // helloa
trace(result) ;
result = insert("hello", 1, "a" ); // haello
trace(result) ;
| lastIndexOfAny | Constant |
public const lastIndexOfAny:FunctionReports the index position of the last occurrence in this instance of one or more characters specified in a Unicode array.
Example :
import core.strings.lastIndexOfAny ;
trace( lastIndexOfAny("hello world", ["2", "hello", "5"]) ); // 0
trace( lastIndexOfAny("Five 5 = 5 and not 2" , ["2", "hello", "5"]) ); // 19
trace( lastIndexOfAny("Five 5 = 5 and not 2" , ["5", "hello", "2"]) ); // 9
trace( lastIndexOfAny("Five 5 = 5 and not 2" , ["5", "hello", "2"] , 8) ); // 5
trace( lastIndexOfAny("Five 5 = 5 and not 2" , ["5", "hello", "2"] , 8 , 3) ); // -1
ArgumentError — if the anyOf argument is 'null' or 'undefined'.
|
| lineTerminatorChars | Constant |
public const lineTerminatorChars:ArrayLike white space characters, line terminator characters are used to improve source text readability and to separate tokens (indivisible lexical units) from each other. However, unlike white space characters, line terminators have some influence over the behaviour of the syntactic grammar. In general, line terminators may occur between any two tokens, but there are a few places where they are forbidden by the syntactic grammar. A line terminator cannot occur within any token, not even a string. Line terminators also affect the process of automatic semicolon insertion.
ECMAScript specification.
| padLeft | Constant |
public const padLeft:FunctionRight-aligns the characters in this instance, padding on the left with a specified Unicode character for a specified total length.
Example :
import core.strings.padLeft ;
trace( padLeft("hello", 8) ) ; // " hello"
trace( padLeft("hello", 8, ".") ); // "...hello"
| padRight | Constant |
public const padRight:FunctionLeft-aligns the characters in this string, padding on the right with a specified Unicode character, for a specified total length.
Example :
import core.strings.padRight ;
trace( padRight("hello", 8) ) ; // "hello "
trace( padRight("hello", 8, ".") ); // "hello..."
| pad | Constant |
public const pad:FunctionApply character padding to a string.
The padding amount is relative to the string length,
if you try to pad the string "hello" (5 chars) with an amount of 10,
you will not add 10 spacing chars to the original string,
but you will obtain " hello", exactly 10 chars after the padding.
A positive amount value will pad the string on the left (right align),
and a negative amount value will pad the string on the right (left align),
import core.strings.pad;
var word:String = "hello";
trace( "[" + pad( word, 8 ) + "]" ); //align to the right
trace( "[" + pad( word, -8 ) + "]" ); //align to the left
//output
//[ hello]
//[hello ]
import core.strings.pad;
var seinfeld:Array = [ "jerry", "george", "kramer", "helen" ];
var len:uint = seinfeld.length ;
for( var i:uint ; i<len ; i++ )
{
trace( pad( seinfeld[i] , 10 , "." ) ) ;
}
//output
//.....jerry
//....george
//....kramer
//.....helen
| repeat | Constant |
public const repeat:FunctionReturns a new String value who contains the specified String characters repeated count times.
Example :
import core.strings.repeat ;
trace( repeat( "hello" , 0 ) ) ; // hello
trace( repeat( "hello" , 3 ) ) ; // hellohellohello
| startsWith | Constant |
public const startsWith:FunctionChecks if this string starts with the specified prefix.
Example :
import core.strings.startsWith ;
var file:String = "hello.txt";
trace( startsWith( file , "hello" ) ) ; // true
| trimEnd | Constant |
public const trimEnd:FunctionRemoves all occurrences of a set of characters specified in an array from the end of this instance.
Example :
import core.strings.trimEnd ;
import core.strings.whiteSpaceChars ;
trace( trimEnd("---hello world---" , ["-"].concat( whiteSpaceChars) ) ); // ---hello world
| trimStart | Constant |
public const trimStart:FunctionRemoves all occurrences of a set of characters specified in an array from the beginning of this instance.
Example :
import core.strings.trimStart ;
import core.strings.whiteSpaceChars ;
trace( trimStart("---hello world---" , ["-"].concat(whiteSpaceChars) ) ); // hello world---
| trim | Constant |
public const trim:FunctionRemoves all occurrences of a set of specified characters (or strings) from the beginning and end of this instance.
Example :
import core.strings.trim ;
trace( trim("\r\t hello world \t ") ); // hello world
| userAgent | Constant |
public const userAgent:FunctionReturns a user-agent string.
based on:
here some examples:
- URLRequestDefaults (only if an AIR app and with compatible option set to true)
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/526.9+ (KHTML, like Gecko) AdobeAIR/1.5"
"Mozilla/5.0 (Windows; U; en) AppleWebKit/526.9+ (KHTML, like Gecko) AdobeAIR/1.5"
"Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/526.9+ (KHTML, like Gecko) AdobeAIR/1.5"
- userAgent
"Tamarin/1.0 cyclone (Macintosh; StandAlone; Mac OS 10.6.7; en; DEBUG) AdobeFlashPlayer/10.0.32.18"
"Tamarin/1.0 cyclone (Macintosh; StandAlone; Mac OS 10.6.7; en; DEBUG) AdobeFlashPlayer/10.0.32.18 MyApp/2.0"
"Tamarin/1.0 cyclone (Macintosh; StandAlone; Mac OS 10.6.7; en; DEBUG) MyApp/2.0"
"Tamarin/1.0 cyclone (Macintosh; StandAlone; DEBUG) AdobeFlashPlayer/10.0.32.18"
"Mozilla/5.0 (Macintosh; StandAlone; Mac OS 10.6.7; en; DEBUG) AdobeFlashPlayer/10.0.32.18"
"Mozilla/5.0 (Macintosh; StandAlone; DEBUG) AdobeFlashPlayer/10.0.32.18"
note:
By default we consider our "product" to be Tamarin, it will work for Flash Player, AIR and RedTamarin.
ex: "Tamarin/1.0 cyclone (Macintosh; ..."
By default if you don't provide an apptoken, it will deduced automatically (eg. "AdobeAIR/1.5" , "AdobeFlashPlayer/9.0.124.0", etc.)
ex: "... Mac OS 10.6.7; en) AdobeFlashPlayer/10.0.32.18"
By default, self application description and application token accumulates
ex: "... Mac OS 10.6.7; en) AdobeFlashPlayer/10.0.32.18 MyApp/2.0"
if you use the `noself` option you can remove the self application description
ex: "... Mac OS 10.6.7; en) MyApp/2.0"
| whiteSpaceChars | Constant |
public const whiteSpaceChars:ArrayContains all white space chars.
Note :