Flash / Flex / ActionScript/String/fromCharCode — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
| |
Текущая версия на 08:14, 26 мая 2010
Converting Between Strings and Unicode or ASCII
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
trace( "New paragraph: " + String.fromCharCode( 182 ) );
trace( "Cents: " + String.fromCharCode( 162 ) );
trace( "Name: " + String.fromCharCode( 68, 97, 114, 114, 111, 110 ) );
}
}
}
Use String.frolmCharCode to create a string
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:String = String.fromCharCode( 191 ) + String.fromCharCode( 243 )
+ String.fromCharCode( 225 )
+ String.fromCharCode( 241 );
if ( example.charCodeAt( 0 ) == 191 ) {
trace( "The string \"" + example + "\" has a \u00BF at the beginning." );
}
}
}
}