Flash / Flex / ActionScript/String/reverse
Версия от 09:19, 26 мая 2010; (обсуждение)
Reversing a String by Word or by Character
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var example:String = "hello dear reader";
var words:Array = example.split( " " );
words.reverse( );
var exampleRevByWord:String = words.join( " " );
trace( exampleRevByWord );
var characters:Array = example.split( "" );
characters.reverse( );
var exampleRevByChar:String = characters.join( "" );
trace( exampleRevByChar );
}
}
}