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

From CodeCodex

m (Reverted edit of 212.0.126.202, changed back to last version by Ldo)
Line 1: Line 1:
{{Infobox See Also String}}
+
[http://yourorus.somee.com/data/produzione-macchina.htm produzione macchina lavorazione legno] [http://madavid.t35.com/html/egitto-nilo/ egitto nilo crociera sul] [http://fergus-mac.somee.com/description/lib/nuove-immagini/ nuove immagini per dirge of cerberus] [http://ouquaite.freeweb7.com/img/styles/lecce-feste/ lecce feste] [http://fawarfo.freeweb7.com/topic/lg-gah.htm lg g09ah] [http://lamcgie.t35.com/web/prov-milano.htm prov milano] [http://dj-deus.somee.com/lib/lavasciuga-da.htm lavasciuga da incasso ariston] [http://dj-deus.somee.com/lib/centali-maurizio.htm centali maurizio] [http://nationavce.somee.com/library/html/gare-cavalli/ gare cavalli] [http://fawarfo.freeweb7.com/topic/hotel-residence.htm hotel residence amalfi] [http://yourorus.somee.com/data/scarica-musica.htm scarica musica di vascorossi] [http://am-i-bird.somee.com/img/styles/black-tit.htm black tit] [http://coarmago.freeweb7.com/library/html/sacchi.htm sacchi] [http://rimarsh.t35.com/images/small/sex-pcs.htm sex pcs] [http://nationavce.somee.com/library/html/volkswagen-polo/ volkswagen polo 1.9] [http://peter-land.somee.com/images/small/lettore-mp.htm lettore mp3 archos 20gb] [http://lensman.somee.com/html/lecce-e/ lecce e dintorni] [http://thegoogly.somee.com/view/new/fiorellino-gianni.htm fiorellino gianni] [http://lensman.somee.com/html/maria-teresa/ maria teresa ruta] [http://betheresa.t35.com/text/directory/ci-pensa/ ci pensa beaver] [http://betheresa.t35.com/text/directory/hammada/ hammada] [http://fawarfo.freeweb7.com/topic/toxic-bretney.htm toxic bretney spears] [http://nationavce.somee.com/library/html/tabelle-millesimali/ tabelle millesimali] [http://thegoogly.somee.com/view/new/canon-stampante.htm canon stampante laser colori] [http://coarmago.freeweb7.com/library/html/miss-maggiolino.htm miss maggiolino] [http://viemalin.freeweb7.com/resources/articles/color-teris.htm color teris] [http://davelovesyou.somee.com/library/html/kyocera-fs/ kyocera fs 9100dn] [http://kiboukni.125mb.com/web/tennis-masters/ tennis masters series 2003] [http://flheddina.t35.com/web/cori-contro/ cori contro inter] [http://de-der.somee.com/library/html/scorpions-tears.htm scorpions tears] [http://fergus-mac.somee.com/description/lib/pantaloncino-spinning/ pantaloncino spinning] [http://davelovesyou.somee.com/library/html/hp-xw/ hp xw8200 workstation scsi] [http://jedillar.125mb.com/resources/articles/music-maker/ music maker basic] [http://thegoogly.somee.com/view/new/strade-del.htm strade del vino italiane] [http://nairoz.somee.com/img/styles/dp-u/ dp 301u] [http://yourorus.somee.com/data/sony-vaio.htm sony vaio lettori mp3] [http://flheddina.t35.com/web/gichi-flash/ gichi flash game download] [http://lakitsmi.freeweb7.com/web/renault-clio/ renault clio 1.5 dci] [http://thegoogly.somee.com/view/new/consulenza-tesi.htm consulenza tesi] [http://davelovesyou.somee.com/library/html/vasco-rossi/ vasco rossi buoni o cattivi] [http://betheresa.t35.com/text/directory/disegni-meier/ disegni meier] [http://fawarfo.freeweb7.com/topic/hl-.htm hl 2030 toner] [http://kiboukni.125mb.com/web/something-in/ something in red] [http://ouquaite.freeweb7.com/img/styles/cindy-crawford/ cindy crawford nuda] [http://dabeutle.t35.com/content/view/bootvis.htm bootvis] [http://davelovesyou.somee.com/library/html/tenistas-rusas/ tenistas rusas] [http://itgurney.t35.com/view/new/irma-va/ irma va a hollywood] [http://itgurney.t35.com/view/new/sfondi-desktop/ sfondi desktop di twetty] [http://rimarsh.t35.com/images/small/vasile-turi.htm vasile, turi] [http://peter-land.somee.com/images/small/vesti-le.htm vesti le bambole] [http://nairoz.somee.com/img/styles/la-a/ la 25a ora dvd] [http://luallard.t35.com/html/lcd-/ lcd 32 hdmi] [http://fawarfo.freeweb7.com/topic/foto-x.htm foto x donne cazzi] [http://flheddina.t35.com/web/labtec-tastiera/ labtec tastiera internet] [http://jututor.125mb.com/lib/inuyasha-serie/ inuyasha. serie 3. vol. 03] [http://flheddina.t35.com/web/cobra-casse/ cobra casse] [http://yourorus.somee.com/data/lucy-carr.htm lucy carr] [http://lamcgie.125mb.com/html/peugeot-.htm peugeot 206 campania] [http://jututor.125mb.com/lib/magic-wizard/ magic wizard] [http://madavid.t35.com/html/philips-hdd/ philips hdd 120] [http://dabeutle.t35.com/content/view/emulatore-playstation.htm emulatore playstation] [http://thegoogly.somee.com/view/new/bulloni.htm bulloni] [http://lakitsmi.freeweb7.com/web/annuncio-vendita/ annuncio vendita case privati milano] [http://trocterli.t35.com/img/styles/mujeres-sexi/ mujeres sexi] [http://de-der.somee.com/library/html/si-perdesse.htm si perdesse a te] [http://kiboukni.125mb.com/web/breve-riassunto/ breve riassunto di il fu mattia pascal] [http://madavid.t35.com/html/spagna-vacanza/ spagna vacanza] [http://yourorus.somee.com/data/video-ostaggi.htm video ostaggi uccisi in iraq] [http://dj-deus.somee.com/lib/gunbound-gm.htm gunbound gm] [http://dabeutle.t35.com/content/view/sesso-in.htm sesso in famiglia] [http://flheddina.t35.com/web/los-asteroides/ los asteroides mas grandes] [http://trocterli.t35.com/img/styles/www-maurizia/ www maurizia com] [http://de-der.somee.com/library/html/annuncio-incontri.htm annuncio incontri italia] [http://itgurney.t35.com/view/new/costruzione-stampo/ costruzione stampo] [http://lamcgie.125mb.com/html/hotel-.htm hotel 3 stella granada] [http://nairoz.somee.com/img/styles/www-gay/ www gay com pe] [http://brrezab.freeweb7.com/img/styles/james-marshall.htm james marshall] [http://jedillar.125mb.com/resources/articles/zarbo/ zarbo] [http://flheddina.t35.com/web/alpha-concept/ alpha concept sas] [http://rihelm.125mb.com/img/styles/if-i/ if i thought you d ever change your mind] [http://coarmago.freeweb7.com/library/html/assicurazione-montpellier.htm assicurazione montpellier] [http://dj-deus.somee.com/lib/happy-days.htm happy days telefilm] [http://nationavce.somee.com/library/html/burnout/ burnout 2] [http://rimarsh.t35.com/images/small/hella-good.htm hella good] [http://luallard.t35.com/html/vaio-fss/ vaio fs215s] [http://nationavce.somee.com/library/html/agriturismo-romagna/ agriturismo romagna] [http://thegoogly.somee.com/view/new/bubble-golden.htm bubble golden pack deluxe] [http://lamcgie.125mb.com/html/idropulsore-braun.htm idropulsore braun md31] [http://betheresa.t35.com/text/directory/kitaro/ kitaro] [http://betheresa.t35.com/text/directory/p-duddy/ p duddy] [http://dabeutle.t35.com/content/view/tapeto.htm tapeto] [http://madavid.t35.com/html/fabrizi-e/ fabrizi e de filippo film dvd] [http://coarmago.freeweb7.com/library/html/things-will.htm things will go my way] [http://yourorus.somee.com/data/izu.htm izu] [http://viemalin.freeweb7.com/resources/articles/zenshu.htm zenshu] [http://madavid.t35.com/html/video-eminem/ video eminem e d12] [http://brrezab.freeweb7.com/img/styles/nina-morich.htm nina morich lingerie] [http://brrezab.freeweb7.com/img/styles/nuova-classe.htm nuova classe a] [http://jedillar.125mb.com/resources/articles/valium-mg/ valium 5mg 20 cps] [http://de-der.somee.com/library/html/veterinari-padova.htm veterinari padova] [http://quotes-girl.somee.com/content/view/flashfxp/ flashfxp] [http://am-i-bird.somee.com/img/styles/www-mattia.htm www mattia lo schiavo com] [http://dabeutle.t35.com/content/view/dancecore.htm dancecore] [http://itgurney.t35.com/view/new/pavilion-zvea/ pavilion zv6149ea] [http://coarmago.freeweb7.com/library/html/olimpus-mju.htm olimpus mju 300] [http://ouquaite.freeweb7.com/img/styles/lavinia/ lavinia] [http://itgurney.t35.com/view/new/ventole-xeon/ ventole xeon] [http://viemalin.freeweb7.com/resources/articles/maxtor-hd.htm maxtor hd 300gb] [http://rimarsh.t35.com/images/small/hauppauge.htm hauppauge] [http://flheddina.t35.com/web/internal-cumshot/ internal cumshot] [http://de-der.somee.com/library/html/aquatici.htm aquatici] [http://peter-land.somee.com/images/small/nokia-.htm nokia 7260 white] [http://lensman.somee.com/html/case-vacanza/ case vacanza affitto liguria] [http://dabeutle.t35.com/content/view/universita-on.htm universita on line] [http://coarmago.freeweb7.com/library/html/stampanti-hp.htm stampanti hp formato a3] [http://fergus-mac.somee.com/description/lib/espana-coni/ espana coni] [http://nairoz.somee.com/img/styles/dvd-recorder/ dvd recorder lg 7800] [http://rimarsh.t35.com/images/small/le-sirenuse.htm le sirenuse] [http://lensman.somee.com/html/enel-distribuizione/ enel distribuizione spa] [http://jututor.125mb.com/lib/due-rrringos/ due rrringos nel texas] [http://lamcgie.125mb.com/html/bimba-mia.htm bimba mia] [http://trocterli.t35.com/img/styles/elle-fizgerald/ elle fizgerald] [http://kiboukni.125mb.com/web/videos-de/ videos de michel viet gratis] [http://lamcgie.t35.com/web/vasco-cosa.htm vasco cosa vuoi da me] [http://peter-land.somee.com/images/small/depilazione-uomo.htm depilazione uomo consigli] [http://quotes-girl.somee.com/content/view/video-nudo/ video nudo] [http://lensman.somee.com/html/tamilsex/ tamilsex] [http://madavid.t35.com/html/financial-risk/ financial risk management] [http://de-der.somee.com/library/html/sennheiser-mx.htm sennheiser mx500] [http://jututor.125mb.com/lib/obiettivo-tele/ obiettivo tele] [http://ouquaite.freeweb7.com/img/styles/judy-greer/ judy greer] [http://davelovesyou.somee.com/library/html/rino-gaetano/ rino gaetano file midi] [http://lamcgie.t35.com/web/pentium.htm pentium 3 0 478] [http://de-der.somee.com/library/html/nick-cave.htm nick cave and the bad seeds. the videos] [http://nairoz.somee.com/img/styles/shove-it/ shove it] [http://trocterli.t35.com/img/styles/fiat-/ fiat 500 c] [http://rimarsh.t35.com/images/small/drunk-sex.htm drunk sex] [http://flheddina.t35.com/web/file-opzioni/ file opzioni pes 5] [http://lakitsmi.freeweb7.com/web/diete-dimagranti/ diete dimagranti gratis] [http://yourorus.somee.com/data/telefonini-motorola.htm telefonini motorola vodafone] [http://yourorus.somee.com/data/dj-store.htm dj store] [http://lamcgie.125mb.com/html/ariete-stiromatic.htm ariete stiromatic 3000 pro 6262] [http://ouquaite.freeweb7.com/img/styles/balere/ balere] [http://dabeutle.t35.com/content/view/exite.htm exite] [http://nationavce.somee.com/library/html/aston-martin/ aston martin db7 vantage] [http://dabeutle.t35.com/content/view/fotocopiatrice.htm fotocopiatrice] [http://peter-land.somee.com/images/small/gallipoli-case.htm gallipoli case vacanza affitto] [http://nationavce.somee.com/library/html/ww-pangea/ ww pangea org] [http://dj-deus.somee.com/lib/tema-maturita.htm tema maturita italiano] [http://trocterli.t35.com/img/styles/barbara-eramo/ barbara eramo] [http://peter-land.somee.com/images/small/naked-girl.htm naked girl] [http://fergus-mac.somee.com/description/lib/canon-ef/ canon ef 28-90mm f 4-5 6] [http://trocterli.t35.com/img/styles/caesartour/ caesartour] [http://jututor.125mb.com/lib/driver-cirrus/ driver cirrus logic] [http://jedillar.125mb.com/resources/articles/coppiaporca/ coppiaporca] [http://peter-land.somee.com/images/small/jak-.htm jak 2 renegade] [http://coarmago.freeweb7.com/library/html/nuove-immagini.htm nuove immagini e nuovo trailer di quake 4] [http://davelovesyou.somee.com/library/html/logitech-mouse/ logitech mouse click] [http://fawarfo.freeweb7.com/topic/napoli-torino.htm napoli -torino] [http://coarmago.freeweb7.com/library/html/seca-files.htm seca1 files] [http://betheresa.t35.com/text/directory/guagnano/ guagnano] [http://yourorus.somee.com/data/snfc.htm snfc] [http://rihelm.125mb.com/img/styles/storia-sull/ storia sull atletica] [http://lamcgie.t35.com/web/jghh.htm jghh] [http://yourorus.somee.com/data/essi-sono.htm essi sono nudi - nudi per morire] [http://dabeutle.t35.com/content/view/obcecion.htm obcecion] [http://fergus-mac.somee.com/description/lib/lampade-fluorescenti/ lampade fluorescenti] [http://lensman.somee.com/html/sophie-moone/ sophie moone] [http://fawarfo.freeweb7.com/topic/auto-scoppio.htm auto scoppio modelli da rally] [http://davelovesyou.somee.com/library/html/foto-di/ foto di ragazze anoressiche] [http://yourorus.somee.com/data/cabaret.htm cabaret 2004] [http://peter-land.somee.com/images/small/proteine-del.htm proteine del siero latte amino pool] [http://betheresa.t35.com/text/directory/blei-franz/ blei, franz] [http://lamcgie.t35.com/web/gadget-roma.htm gadget roma] [http://flheddina.t35.com/web/zemljevid-primorske/ zemljevid primorske] [http://kiboukni.125mb.com/web/porta-basculante/ porta basculante per gatti] [http://flheddina.t35.com/web/ps-pc/ ps2 pc converter] [http://kiboukni.125mb.com/web/quinto-passo/ quinto passo libri] [http://davelovesyou.somee.com/library/html/samsung-progressive/ samsung progressive] [http://thegoogly.somee.com/view/new/over.htm over 30] [http://brrezab.freeweb7.com/img/styles/centri-per.htm centri per l impiego lecce] [http://lensman.somee.com/html/oracle-warehouse/ oracle warehouse builder] [http://fergus-mac.somee.com/description/lib/tv-retroproiezione/ tv retroproiezione] [http://kiboukni.125mb.com/web/non-si/ non si puo morire dentro] [http://betheresa.t35.com/text/directory/mitchell/ mitchell] [http://quotes-girl.somee.com/content/view/segretario-a/ segretario a mezzanotte] [http://davelovesyou.somee.com/library/html/galliano/ galliano] [http://lamcgie.125mb.com/html/perche-la.htm perche la chiesa giussani] [http://am-i-bird.somee.com/img/styles/televisori-lcd.htm televisori lcd 15] [http://itgurney.t35.com/view/new/tv-color/ tv color amstrad 14] [http://itgurney.t35.com/view/new/interlude/ interlude] [http://coarmago.freeweb7.com/library/html/ufficio-mondovi.htm ufficio mondovi] [http://madavid.t35.com/html/nokia-cellulare/ nokia cellulare 3200] [http://dj-deus.somee.com/lib/infermiere-troie.htm infermiere troie] [http://ouquaite.freeweb7.com/img/styles/link-erotico/ link erotico] [http://am-i-bird.somee.com/img/styles/paris-tu.htm paris tu m as pris dans tes bras] [http://quotes-girl.somee.com/content/view/acer-aspire/ acer aspire cristalbrite] [http://davelovesyou.somee.com/library/html/la-camisa/ la camisa negra de juanes] [http://luallard.t35.com/html/affitti-liguria/ affitti liguria] [http://dj-deus.somee.com/lib/compaq-presario.htm compaq presario 7460] {{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 21:00, 22 August 2007

produzione macchina lavorazione legno egitto nilo crociera sul nuove immagini per dirge of cerberus lecce feste lg g09ah prov milano lavasciuga da incasso ariston centali maurizio gare cavalli hotel residence amalfi scarica musica di vascorossi black tit sacchi sex pcs volkswagen polo 1.9 lettore mp3 archos 20gb lecce e dintorni fiorellino gianni maria teresa ruta ci pensa beaver hammada toxic bretney spears tabelle millesimali canon stampante laser colori miss maggiolino color teris kyocera fs 9100dn tennis masters series 2003 cori contro inter scorpions tears pantaloncino spinning hp xw8200 workstation scsi music maker basic strade del vino italiane dp 301u sony vaio lettori mp3 gichi flash game download renault clio 1.5 dci consulenza tesi vasco rossi buoni o cattivi disegni meier hl 2030 toner something in red cindy crawford nuda bootvis tenistas rusas irma va a hollywood sfondi desktop di twetty vasile, turi vesti le bambole la 25a ora dvd lcd 32 hdmi foto x donne cazzi labtec tastiera internet inuyasha. serie 3. vol. 03 cobra casse lucy carr peugeot 206 campania magic wizard philips hdd 120 emulatore playstation bulloni annuncio vendita case privati milano mujeres sexi si perdesse a te breve riassunto di il fu mattia pascal spagna vacanza video ostaggi uccisi in iraq gunbound gm sesso in famiglia los asteroides mas grandes www maurizia com annuncio incontri italia costruzione stampo hotel 3 stella granada www gay com pe james marshall zarbo alpha concept sas if i thought you d ever change your mind assicurazione montpellier happy days telefilm burnout 2 hella good vaio fs215s agriturismo romagna bubble golden pack deluxe idropulsore braun md31 kitaro p duddy tapeto fabrizi e de filippo film dvd things will go my way izu zenshu video eminem e d12 nina morich lingerie nuova classe a valium 5mg 20 cps veterinari padova flashfxp www mattia lo schiavo com dancecore pavilion zv6149ea olimpus mju 300 lavinia ventole xeon maxtor hd 300gb hauppauge internal cumshot aquatici nokia 7260 white case vacanza affitto liguria universita on line stampanti hp formato a3 espana coni dvd recorder lg 7800 le sirenuse enel distribuizione spa due rrringos nel texas bimba mia elle fizgerald videos de michel viet gratis vasco cosa vuoi da me depilazione uomo consigli video nudo tamilsex financial risk management sennheiser mx500 obiettivo tele judy greer rino gaetano file midi pentium 3 0 478 nick cave and the bad seeds. the videos shove it fiat 500 c drunk sex file opzioni pes 5 diete dimagranti gratis telefonini motorola vodafone dj store ariete stiromatic 3000 pro 6262 balere exite aston martin db7 vantage fotocopiatrice gallipoli case vacanza affitto ww pangea org tema maturita italiano barbara eramo naked girl canon ef 28-90mm f 4-5 6 caesartour driver cirrus logic coppiaporca jak 2 renegade nuove immagini e nuovo trailer di quake 4 logitech mouse click napoli -torino seca1 files guagnano snfc storia sull atletica jghh essi sono nudi - nudi per morire obcecion lampade fluorescenti sophie moone auto scoppio modelli da rally foto di ragazze anoressiche cabaret 2004 proteine del siero latte amino pool blei, franz gadget roma zemljevid primorske porta basculante per gatti ps2 pc converter quinto passo libri samsung progressive over 30 centri per l impiego lecce oracle warehouse builder tv retroproiezione non si puo morire dentro mitchell segretario a mezzanotte galliano perche la chiesa giussani televisori lcd 15 tv color amstrad 14 interlude ufficio mondovi nokia cellulare 3200 infermiere troie link erotico paris tu m as pris dans tes bras acer aspire cristalbrite la camisa negra de juanes affitti liguria compaq presario 7460

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]|[ !@#\\$%\\^