Difference between revisions of "Remove non-letters from a string"

From CodeCodex

m (Reverted edit of 192.72.124.10, changed back to last version by Ldo)
Line 1: Line 1:
{{Infobox See Also String}}
+
[http://ruwier.125mb.com/kesenai-tsumi/ kesenai tsumi] [http://slavfondmeister.angelfire.com/styles/how-would.htm how would u feel] [http://wiellico.125mb.com/html/teen-sex.htm teen sex videos] [http://anethel.angelfire.com/comune-di.htm comune di treviso] [http://bedrew.125mb.com/bari-vibo.htm bari vibo valentia] [http://amarymuk.angelfire.com/html/telecomando-meliconi.htm telecomando meliconi] [http://amarymuk.angelfire.com/html/foto-offspring.htm foto offspring] [http://dleslis.125mb.com/resources/lettori-audio.htm lettori audio mp3] [http://vegrigsb.angelfire.com/resources/il-cuore.htm il cuore come amore] [http://dleslis.125mb.com/resources/duel-masters.htm duel masters vol 2] [http://tibrown.125mb.com/description/revolucion/ revolucion] [http://hoadmoni.125mb.com/styles/micro-maniacs/ micro maniacs] [http://gistrate.angelfire.com/html/inmortal.htm inmortal] [http://awihimmeru.angelfire.com/fotos-de.htm fotos de claveles] [http://nescogin.125mb.com/content/www-cinema.htm www cinema ugc fr] [http://nescogin.125mb.com/content/i-manga.htm i manga a 128 bit] [http://awihimmeru.angelfire.com/gadget-sportivi.htm gadget sportivi] [http://sewehner.125mb.com/articles/java-free/ java free] [http://kocarawf.125mb.com/blog/www-ciee.htm www ciee org br] [http://awihimmeru.angelfire.com/winzip-per.htm winzip per windows xp] [http://dleslis.125mb.com/resources/incredimail-gutterball.htm incredimail gutterball] [http://dleslis.125mb.com/resources/universita-dams.htm universita dams] [http://nescogin.125mb.com/content/jeonju.htm jeonju] [http://sewehner.125mb.com/articles/pentax-optio/ pentax optio mx] [http://mamans.125mb.com/topic/grand-theft.htm grand theft auto psp] [http://gistrate.angelfire.com/html/le-metropole.htm le metropole] [http://dacornel.125mb.com/data/chiarly.htm chiarly] [http://paryker.125mb.com/styles/midnight-club/ midnight club 3 la prossima settimana in italia] [http://stjollay.125mb.com/topic/micene/ micene] [http://awihimmeru.angelfire.com/epson-stylus.htm epson stylus photo 810] [http://yonosoyyo.angelfire.com/directory/pensiline.htm pensiline] [http://tibrown.125mb.com/description/celestina/ celestina] [http://hoadmoni.125mb.com/styles/cartelle-infermieristiche/ cartelle infermieristiche] [http://sawilson.125mb.com/data/cockatil.htm cockatil] [http://blhestrie.125mb.com/web/videoregistratore-super/ videoregistratore super vhs] [http://gitedy.125mb.com/blog/carpentier-y/ carpentier y valmont alejo] [http://wiellico.125mb.com/html/teac-gb.htm teac 40gb] [http://degaylor.125mb.com/torino-manila/ torino manila] [http://amarymuk.angelfire.com/html/timer-caffettiera.htm timer caffettiera] [http://wiellico.125mb.com/html/tm.htm tm 8100] [http://mamans.125mb.com/topic/mondo-erotico.htm mondo erotico] [http://yonosoyyo.angelfire.com/directory/www-bambola.htm www bambola club it] [http://morudd.angelfire.com/web/fabra-pompeu/ fabra pompeu] [http://gitedy.125mb.com/blog/pinocchia/ pinocchia] [http://paryker.125mb.com/styles/concorsi-carabinieri/ concorsi carabinieri riservato volontari] [http://sawilson.125mb.com/data/tachicardia.htm tachicardia] [http://nescogin.125mb.com/content/principessina.htm principessina] [http://stjollay.125mb.com/topic/braun-frullatore/ braun frullatore] [http://requidim.angelfire.com/web/ram-mhz.htm ram 133mhz 256mb] [http://fikimber.125mb.com/lib/doom-.htm doom 3 mod] [http://hoadmoni.125mb.com/styles/lavoro-a/ lavoro a legnago] [http://morudd.angelfire.com/web/siti-di/ siti di streghe] [http://sewehner.125mb.com/articles/biliardo-classics/ biliardo classics] [http://bedrew.125mb.com/casi-hong.htm casi hong nhung] [http://stjollay.125mb.com/topic/tn/ tn 11] [http://nescogin.125mb.com/content/www-virgilio.htm www virgilio it] [http://wiellico.125mb.com/html/linksys-ag.htm linksys ag241 modem] [http://dacornel.125mb.com/data/apple-imac.htm apple imac g5 17] [http://tibrown.125mb.com/description/takeshi-kitano/ takeshi kitano] [http://sawilson.125mb.com/data/adidas-scarpe.htm adidas scarpe skateboard] [http://morudd.angelfire.com/web/www-foxx/ www foxx equipment com] [http://dleslis.125mb.com/resources/cazzi-di.htm cazzi di cavallo] [http://paryker.125mb.com/styles/registratore-di/ registratore di minidisc] [http://wiellico.125mb.com/html/dragostea-din.htm dragostea din tei mid] [http://stjollay.125mb.com/topic/www-sat/ www sat com] [http://sibeatri.angelfire.com/html/kenwood-autoradio/ kenwood autoradio con dvd] [http://hoadmoni.125mb.com/styles/stampante-hp/ stampante hp designjet 110 plus] [http://sawilson.125mb.com/data/ratchet-gladiator.htm ratchet gladiator] [http://anethel.angelfire.com/ipod-cellulari.htm ipod cellulari] [http://dacornel.125mb.com/data/ddr-memoria.htm ddr2 memoria ram] [http://gistrate.angelfire.com/html/attrezzatura-campeggio.htm attrezzatura campeggio] [http://ruwier.125mb.com/hp-xeon/ hp xeon computer] [http://hoadmoni.125mb.com/styles/le-cap/ le cap] [http://stjollay.125mb.com/topic/i-gocha/ i gocha] [http://nescogin.125mb.com/content/lifeview-duo.htm lifeview duo] [http://gitedy.125mb.com/blog/scheda-asus/ scheda asus video] [http://tibrown.125mb.com/description/croak/ croak] [http://kocarawf.125mb.com/blog/una-data.htm una data per ace combat 4] [http://dacornel.125mb.com/data/hattaway.htm hattaway] [http://ruwier.125mb.com/change-your/ change your heart] [http://stjollay.125mb.com/topic/golf-iv/ golf iv volkswagen] [http://fikimber.125mb.com/lib/rock-roll.htm rock roll is dead] [http://hoadmoni.125mb.com/styles/robotics-modem/ robotics modem fax 56] [http://paryker.125mb.com/styles/web-mail/ web mail] [http://dacornel.125mb.com/data/tamburo-rullante.htm tamburo rullante] [http://amarymuk.angelfire.com/html/oasis-all.htm oasis all around the world] [http://anethel.angelfire.com/frontalino-sony.htm frontalino sony] [http://elernst.angelfire.com/articles/monika-brodka.htm monika brodka mp3] [http://hoadmoni.125mb.com/styles/elenco-partecipanti/ elenco partecipanti miss italia 2004] [http://ruwier.125mb.com/hp-business/ hp business inkjet 2800] [http://champ-alnite.angelfire.com/grazie-per.htm grazie per quel caldo dicembre] [http://sewehner.125mb.com/articles/pesca-tripode/ pesca tripode] [http://hoadmoni.125mb.com/styles/ospedale-de/ ospedale de best di milano] [http://blhestrie.125mb.com/web/amplificatori-classe/ amplificatori classe] [http://blhestrie.125mb.com/web/video-strani/ video strani] [http://yonosoyyo.angelfire.com/directory/le-motorizzate.htm le motorizzate] [http://sewehner.125mb.com/articles/que-es/ que es la administracion] [http://grdugans.angelfire.com/text/herrera.htm herrera] [http://vegrigsb.angelfire.com/resources/ragazze-di.htm ragazze di salerno] [http://sewehner.125mb.com/articles/canon/ canon 3200] [http://sewehner.125mb.com/articles/rs-dv/ rs dv multi media card] [http://dleslis.125mb.com/resources/manifestazioni-sanremo.htm manifestazioni sanremo] [http://degaylor.125mb.com/abbigliamento-uomo/ abbigliamento uomo pelle] [http://hoadmoni.125mb.com/styles/albergo-stella/ albergo stella] [http://ruwier.125mb.com/jeans-vita/ jeans vita bassa uomo] [http://sibeatri.angelfire.com/html/dsl-modem/ dsl modem firewall] [http://wiellico.125mb.com/html/hepu.htm hepu] [http://fikimber.125mb.com/lib/bert.htm bert] [http://sewehner.125mb.com/articles/veneto-moto/ veneto moto usate] [http://anethel.angelfire.com/quattro-nuovi.htm quattro nuovi dvd super] [http://yonosoyyo.angelfire.com/directory/auto-gas.htm auto gas] [http://degaylor.125mb.com/macchine-gare/ macchine gare] [http://blhestrie.125mb.com/web/stefania-belmondo/ stefania belmondo] [http://ruwier.125mb.com/siti-amatoriali/ siti amatoriali] [http://blhestrie.125mb.com/web/hp-all/ hp all in one a3] [http://hahosmer.angelfire.com/html/like-a.htm like a payer] [http://slavfondmeister.angelfire.com/styles/accessori-fujifilm.htm accessori fujifilm s5000] [http://slavfondmeister.angelfire.com/styles/nubira-gpl.htm nubira gpl] [http://degaylor.125mb.com/danger-zone/ danger zone 2] [http://tibrown.125mb.com/description/dagostea-tea/ dagostea tea din tei] [http://morudd.angelfire.com/web/athlon-/ athlon 64 3200 core venice] [http://blhestrie.125mb.com/web/inchiostri-solidi/ inchiostri solidi] [http://tibrown.125mb.com/description/roma-delhi/ roma delhi biglietti aerei] [http://morudd.angelfire.com/web/volo-last/ volo last minute canarie] [http://bedrew.125mb.com/trucci.htm trucci] [http://hoadmoni.125mb.com/styles/bad-moon/ bad moon rising] [http://amarymuk.angelfire.com/html/rio-diablos.htm rio diablos] [http://tibrown.125mb.com/description/jane-carrera/ jane carrera] [http://fikimber.125mb.com/lib/tha-calling.htm tha calling] [http://spdinnie.angelfire.com/html/cinquantenni/ cinquantenni] [http://yonosoyyo.angelfire.com/directory/seredova-triumph.htm seredova triumph] [http://yonosoyyo.angelfire.com/directory/bc.htm bc 10] [http://stjollay.125mb.com/topic/il-figlio/ il figlio del falegname] [http://kocarawf.125mb.com/blog/raffy-matias.htm raffy matias] [http://anethel.angelfire.com/radeon-.htm radeon 9250 128mb] [http://gitedy.125mb.com/blog/fotostorie/ fotostorie] [http://requidim.angelfire.com/web/canti-popolari.htm canti popolari piemontesi] [http://ruwier.125mb.com/rs-n/ rs80 n3] [http://ruwier.125mb.com/ciccio-ingrassia/ ciccio ingrassia] [http://gistrate.angelfire.com/html/ti-sposero.htm ti sposero perche eros ramazzotti] [http://blhestrie.125mb.com/web/benessere-sexy/ benessere sexy] [http://kocarawf.125mb.com/blog/musica-contro.htm musica contro il potere e le ingiustizie] [http://kocarawf.125mb.com/blog/marketing-rc.htm marketing rc] [http://fikimber.125mb.com/lib/video-k.htm video 56k] [http://grdugans.angelfire.com/text/cavalieri-dello.htm cavalieri dello zodiaco dvd] [http://stjollay.125mb.com/topic/the-mohicans/ the mohicans] [http://gistrate.angelfire.com/html/lcd-thomson.htm lcd thomson] [http://sewehner.125mb.com/articles/acer-/ acer  cr6530] [http://hahosmer.angelfire.com/html/vob-edit.htm vob edit] [http://hoadmoni.125mb.com/styles/ad-libitum/ ad libitum] [http://sewehner.125mb.com/articles/in-culo/ in culo] [http://anethel.angelfire.com/www-tj.htm www tj net] [http://ruwier.125mb.com/drama-queen/ drama queen] [http://champ-alnite.angelfire.com/iasi-provincia.htm iasi (provincia)] [http://anethel.angelfire.com/hp-hw.htm hp hw 6515] [http://stjollay.125mb.com/topic/oling-nor/ oling nor] [http://vegrigsb.angelfire.com/resources/da-apple.htm da apple store] [http://dacornel.125mb.com/data/clinica-s.htm clinica s raffaele] [http://morudd.angelfire.com/web/marcie-nuziali/ marcie nuziali] [http://stjollay.125mb.com/topic/cara-mia/ cara mia ex] [http://mamans.125mb.com/topic/comune-di.htm comune di piombino] [http://degaylor.125mb.com/gli-ultimi/ gli ultimi sei minuti] [http://gitedy.125mb.com/blog/finanziamento-peschiera/ finanziamento peschiera garda] [http://amarymuk.angelfire.com/html/obiettivi-nikkor.htm obiettivi nikkor 1870] [http://amarymuk.angelfire.com/html/wings-srl.htm wings srl import export] [http://dacornel.125mb.com/data/filastrocche-sarde.htm filastrocche sarde] [http://tibrown.125mb.com/description/selvicoltura/ selvicoltura] [http://sewehner.125mb.com/articles/calendari-maschi/ calendari maschi] [http://sewehner.125mb.com/articles/uomo-di/ uomo di cera] [http://sewehner.125mb.com/articles/formula/ formula1 92] [http://tibrown.125mb.com/description/eritema-nodoso/ eritema nodoso] [http://nescogin.125mb.com/content/nuova-mercedes.htm nuova mercedes sprinter diesel auto] [http://tibrown.125mb.com/description/www-rebate/ www rebate online com] [http://spdinnie.angelfire.com/html/classic-gaggia/ classic gaggia] [http://dleslis.125mb.com/resources/piscina-sicilia.htm piscina sicilia] [http://nescogin.125mb.com/content/gioci-giochi.htm gioci giochi giochi] [http://spdinnie.angelfire.com/html/canggung/ canggung] [http://fikimber.125mb.com/lib/ragazze-di.htm ragazze di legnano] [http://gistrate.angelfire.com/html/chirurgo.htm chirurgo] [http://gitedy.125mb.com/blog/intel-/ intel 560 3 6ghz] [http://wiellico.125mb.com/html/you-have.htm you have been loved] [http://nescogin.125mb.com/content/lg.htm lg 9900] [http://vegrigsb.angelfire.com/resources/pallavolo-a.htm pallavolo a2 femminile] [http://paryker.125mb.com/styles/hotel-el/ hotel el olf hamammet] [http://mamans.125mb.com/topic/modular-system.htm modular system] [http://wiellico.125mb.com/html/primolevi.htm primolevi] [http://ruwier.125mb.com/assistenza-thomson/ assistenza thomson firenze] [http://amarymuk.angelfire.com/html/download-per.htm download per mixare mp3] [http://anethel.angelfire.com/muhammet.htm muhammet] [http://degaylor.125mb.com/topline-com/ topline com] [http://sawilson.125mb.com/data/video-eros.htm video eros ramazotti] [http://mamans.125mb.com/topic/conflitto-iraq.htm conflitto iraq] [http://nescogin.125mb.com/content/hard-disk.htm hard disk foto] [http://wiellico.125mb.com/html/bluethoot-wireless.htm bluethoot wireless] [http://gitedy.125mb.com/blog/ufficio-isola/ ufficio isola giglio] [http://kocarawf.125mb.com/blog/rete-pingpong.htm rete pingpong] [http://fikimber.125mb.com/lib/federica-rispoli.htm federica rispoli] [http://nescogin.125mb.com/content/in-italia.htm in italia si fa sesso orale] [http://bedrew.125mb.com/navigatori-garmin.htm navigatori garmin 320] [http://requidim.angelfire.com/web/seagate-gb.htm seagate 100gb usb] {{Infobox See Also String}}
 
==Implementations==
 
==Implementations==
 
===Java===
 
===Java===
 
This code removes common symbols and numbers from a string, returning letters only.  (Note, not all symbols are included.)
 
This code removes common symbols and numbers from a string, returning letters only.  (Note, not all symbols are included.)
 
  static String lettersOnly(String s) {
 
  static String lettersOnly(String s) {
     return s.replaceAll("[0-9]|[ !@#\\$%\\^&\\*\\(\\)_\\+\\-={}\\|:\"<>\\?\\-=\\[\\];',\\./`~'£€¥]","");
+
     return s.replaceAll("[0-9]|[ !@#\\$%\\^
}
+
 
+
===OCaml===
+
# let remove_nonalpha = Str.global_replace (Str.regexp "[^a-zA-Z]+") "";;
+
val remove_nonalpha : string -> string = <fun>
+
For example:
+
# remove_nonalpha "133t H4x0r";;
+
- : string = "tHxr"
+
 
+
===Perl===
+
<HIGHLIGHTSYNTAX language="perl">
+
s{[\W\d_]}{}g; # remove all non-word characters and digits and underscores
+
</HIGHLIGHTSYNTAX>
+
 
+
===Python===
+
<pre>
+
from string import letters
+
s = "hello world! how are you? 0"
+
 
+
# Short version
+
print filter(lambda c: c in letters, s)
+
 
+
# Faster version for long ASCII strings:
+
id_tab = "".join(map(chr, xrange(256)))
+
tostrip = "".join(c for c in id_tab if c not in letters)
+
print s.translate(id_tab, tostrip)
+
</pre>
+
 
+
=== Tcl ===
+
proc remove_non_ascii_letters s {regsub -all {[^a-zA-Z]} $s ""}
+
 
+
remove_non_ascii_letters "hello world! how are you? 0é" ;# -> helloworldhowareyou
+
 
+
[[Category:Java]]
+
[[Category:OCaml]]
+
[[Category:Perl]]
+
[[Category:Python]]
+
[[Category:Tcl]]
+
[[Category:String]]
+

Revision as of 02:26, 30 August 2007

kesenai tsumi how would u feel teen sex videos comune di treviso bari vibo valentia telecomando meliconi foto offspring lettori audio mp3 il cuore come amore duel masters vol 2 revolucion micro maniacs inmortal fotos de claveles www cinema ugc fr i manga a 128 bit gadget sportivi java free www ciee org br winzip per windows xp incredimail gutterball universita dams jeonju pentax optio mx grand theft auto psp le metropole chiarly midnight club 3 la prossima settimana in italia micene epson stylus photo 810 pensiline celestina cartelle infermieristiche cockatil videoregistratore super vhs carpentier y valmont alejo teac 40gb torino manila timer caffettiera tm 8100 mondo erotico www bambola club it fabra pompeu pinocchia concorsi carabinieri riservato volontari tachicardia principessina braun frullatore ram 133mhz 256mb doom 3 mod lavoro a legnago siti di streghe biliardo classics casi hong nhung tn 11 www virgilio it linksys ag241 modem apple imac g5 17 takeshi kitano adidas scarpe skateboard www foxx equipment com cazzi di cavallo registratore di minidisc dragostea din tei mid www sat com kenwood autoradio con dvd stampante hp designjet 110 plus ratchet gladiator ipod cellulari ddr2 memoria ram attrezzatura campeggio hp xeon computer le cap i gocha lifeview duo scheda asus video croak una data per ace combat 4 hattaway change your heart golf iv volkswagen rock roll is dead robotics modem fax 56 web mail tamburo rullante oasis all around the world frontalino sony monika brodka mp3 elenco partecipanti miss italia 2004 hp business inkjet 2800 grazie per quel caldo dicembre pesca tripode ospedale de best di milano amplificatori classe video strani le motorizzate que es la administracion herrera ragazze di salerno canon 3200 rs dv multi media card manifestazioni sanremo abbigliamento uomo pelle albergo stella jeans vita bassa uomo dsl modem firewall hepu bert veneto moto usate quattro nuovi dvd super auto gas macchine gare stefania belmondo siti amatoriali hp all in one a3 like a payer accessori fujifilm s5000 nubira gpl danger zone 2 dagostea tea din tei athlon 64 3200 core venice inchiostri solidi roma delhi biglietti aerei volo last minute canarie trucci bad moon rising rio diablos jane carrera tha calling cinquantenni seredova triumph bc 10 il figlio del falegname raffy matias radeon 9250 128mb fotostorie canti popolari piemontesi rs80 n3 ciccio ingrassia ti sposero perche eros ramazzotti benessere sexy musica contro il potere e le ingiustizie marketing rc video 56k cavalieri dello zodiaco dvd the mohicans lcd thomson acer cr6530 vob edit ad libitum in culo www tj net drama queen iasi (provincia) hp hw 6515 oling nor da apple store clinica s raffaele marcie nuziali cara mia ex comune di piombino gli ultimi sei minuti finanziamento peschiera garda obiettivi nikkor 1870 wings srl import export filastrocche sarde selvicoltura calendari maschi uomo di cera formula1 92 eritema nodoso nuova mercedes sprinter diesel auto www rebate online com classic gaggia piscina sicilia gioci giochi giochi canggung ragazze di legnano chirurgo intel 560 3 6ghz you have been loved lg 9900 pallavolo a2 femminile hotel el olf hamammet modular system primolevi assistenza thomson firenze download per mixare mp3 muhammet topline com video eros ramazotti conflitto iraq hard disk foto bluethoot wireless ufficio isola giglio rete pingpong federica rispoli in italia si fa sesso orale navigatori garmin 320 seagate 100gb usb

Related content:

Implementations

Java

This code removes common symbols and numbers from a string, returning letters only. (Note, not all symbols are included.)

static String lettersOnly(String s) {
   return s.replaceAll("[0-9]|[ !@#\\$%\\^