Estou mandando pra voces uma classe que pode fazer tudo o que a classe String faz mas com métodos adicionados, para facilitar a manipulacao de Strings no flash
Ela foi feita por mim com a ajuda do Maxwell Dayvson
Publicidade
|
|
Page 1 of 1
Classe para manipulacao de String flash mx 2004 na veia...
#1
Posted 01 June 2004 - 12:51 PM
| CODE |
/* Classe Str v1.0 feita para faciliar a manipulacao de Strings criada por Andrews Medina (cybermix) auxílio:Maxwell Dayvson */ dynamic class Str extends String { function Str(texto:String) { super(texto); } public function removeAcento():String { var x,str:String=this; var lista= {a:['á','ã','à','â'], e:['é','ê','è','ë'], i:['í','ì','ï','î'], o:['ó','ô','ò','õ'],u:['ú','ù','ü','û']}; for (x in lista) { for (var i:Number=lista[x].length; i--;) { str = str.split(lista[x][i].toUpperCase()).join(x.toUpperCase()); str = str.split(lista[x][i]).join(x); } } return(str); } public function replace(v:String, n:String):String { var r:String = this; r = r.split(v).join(n); return(r); } public function trim():String { var i:Number; var texto:String = this; for (i=0; texto.charAt(i) == " "; i++); texto = texto.substr(i, texto.length); for (i=texto.length-1; texto.charAt(i) == " "; i--); texto = texto.substr(0, i+1); return (texto); } public function ltrim():String { var i:Number; var texto:String = this; for (i=0; texto.charAt(i) == " "; i++); texto = texto.substr(i, texto.length); return (texto); } public function rtrim():String { var i:Number; var texto:String = this; for (i=texto.length-1; texto.charAt(i) == " "; i--); texto = texto.substr(0, i+1); return (texto); } public function inverte():String { var text:String = this; return(texto.split("").reverse().join("").toString()); } public function retEspacos():String { var texto:Str = new Str(this); return (texto.replace(" ", "")); } } |
Exemplo do seu uso:
| CODE |
import Str; var texto:Str = new Str(" Andrews medina é vicio em flash mx 2004 "); trace(texto.removeAcento()); trace("<"+texto.trim()+">"); trace("<"+texto.ltrim()+">"); trace("<"+texto.rtrim()+">"); trace(texto.replace("m", "Y")); trace(texto.inverte()); trace(texto.retEspacos()); //alguns metodos da classe string para verem como é legal =D trace(texto.indexOf("med", 0)); trace(texto.length); |
Share this topic:
Page 1 of 1
Similar Topics
| Topic | Forum | Started By | Stats | Last Post Info | |
|---|---|---|---|---|---|
|
Lista xml com paginação em flash AS2
|
Flash & ActionScript |
ayresraphael
|
|
|
|
Novo Artigo no Portal
Estudo da Classe TransitionManager |
Tutoriais e Artigos |
Natan
|
|
|
|
Harry Potter ganha versão Lego para videogame
|
Notícias |
Notícias
|
|
|
|
Form flash + PHP: o q tá errado desse PHP??
alguem dá uma mão ae..... |
PHP |
Silser
|
|
|
|
dreamweaver 2004 não instala?
|
Dreamweaver |
lulaca
|
|
|
|
impressão no flash
faixas pretas |
Flash & ActionScript |
thiago9864
|
|
|
|
Som
como fazer para...... |
Flash & ActionScript |
All
|
|
|
|
Google sela parcerias de conteúdo para novo sistema de TV com internet
|
Notícias |
Notícias
|
|
Publicidade
|
|

Help













