Talk:String Handling Routines

From Kolmafia
Revision as of 00:11, 22 September 2007 by 222.86.132.20 (talk)
Jump to navigation Jump to search

profumi christian dior dolce vita order viagra online circolari associazione bancari google games toyota rav 4 sol 5p mercedes s 320 femina stand up us people una donna in gabbia sony minidv hdrhc1 ludacris act afool sati trading srl baby bird driver ipm datacom sexy movie croata un amore passeggero lesbiche savona norah jones testi neo rage amplificatore home theatre wireless coccodrillo come italia campania vacanze in adsl router wi crimson butterfly my tuscany inglesina passeggino metal slug 8 hasni staffier ciorba storia di internet champion felpa johann strauss simplicius a beverly hills signori si diventa canzoni siciliane dretu cristianesimo origini cappello a cilindro fighe rosse pelose hp color laserjet 2840 sei grande dio full cd ovamboland eos 10 half fire xl campione body building romeo ventura sas mezzogiorno vittoria mac monitor sissignore il gioco di domani porno pompino gimmy fontana noticias escritas disegni grafica loghi sito della regone veneto what is the wather for friday sesso sfrenato gecofin spa hp 81 hard disk 205 egan pierce soluzione max payne triste someday bloody someday mama said un annuncio ufficiale per lineage 2 calendario de niurka y bobby mestre hotel hosting windows tutti i calendari di pamela anderson www elisa it macchina per fare il pane jeans uomo linea gamba svasata pd opel astra diesel km 0 citroen c2 1 4 hdi elegance fiesta km 0 diesel la gondola delle chimere regione liguria tour sri lanka this love marron 5 testo italiano escada margaretha ley body lotion dino merlin zeljko joksimovic supermen mansfield (gran bretagna) ear monitor tennis 34d router firewall 11g wireless adsl 3com onolulu www islamonline com borsa notebook 12 sony dcrhc 16 spogliarelli mini one de luxe ariyoshi sawako eos 300d canon ente turismo francese philips sacd galleria di photo catwoman Contatti di msn troie Cucine classiche Cad meccanico gratis Filmato divertenti Dublino albergo Temi per cellulare Infermiere tettone Vecchie puttane Porche grasse Settimo cielo Corso d istruzione scuola Troie prato Pallamano femminile Alexa cohf Compro casa como Anni 80 Jumpy gioco it Soli tribali Portone tagliafuoco Albergo sanremo Siracusacalcio Visore notturno Albergo con piscina valle d aosta Apricena Zizza Cognata Donate car Bologna distribuzione volantino Snals Totosi Video rumene Kristina fey Dolce gabbana it Coscia aperta Sfondo gratis Acoweb Fabbro Ragazzine nude Icm pentola Albergo bucarest Barbone Stampante brother Sella it Tatuaggi scritte Alessandro magno Ereditarieta gruppo sanguigno Melita calendario lucignolo Porno tv gratis Fapi scaccia zanzara Orologio tudor usato Hotel due stelle parigi Curriculum europeo Roberta missoni porno Disegni dei gormiti Visura protesto gratis Pentola rame Decapitazione Canotta nba Big tit monster Accessorio trasporto bici Finanziamento toscana Lavagne Creberg it Affitto casa prato nevoso Arredo legno esterno Bambine troie Porto sant elpidio Nonne viziose Colposcopia Noleggio auto messico Sexvideopro Trucco yu gi oh ps1 Laura torrisi topless Orgia lesbica Calcola percorso Gabetti Gruppo elettrogeno Lisbona vacanza Studentesse calde Porno svedesi Sci hotel sestriere Oroscopo cinese Grifoni net Casetta bambino Brico ok Andalusia ambiente Il nuovo oroscopo oggi Gormiti giochi Www paginegialle it Black monster anal Grammatica francese Nudiste hard Porno video gratis masturbazione Filtro adsl schema costruzione Barbie griffin Clonedvd Cessione quinto prestito Finanziamento idea Test quoziente intellettivo gratis Ogrish So wtf does group_string actually do? The linked "descriptive" post has an utterly unhelpful example. Has anyone ever used it for anything?

Groups a string into a map using a regular expression. To understand the function you must know. 1. What maps are and how they are used. 2. Understand what regular expressions are and how to create them.

Using the original post:

FUNCTION DEFINTION: string [int,int] group_string( string source, string regex ) EXAMPLE: string [int,int] test = group_string( "This is a test", "([a-z] ) " );

Example Breakdown: string [int,int] Define a map. Two dimensional. The indices are integers. The data is stored as a string. test Define the map with name test. group_string Call the function. "This is a Test" Feeding the function a sample string. "([a-z] ) " Your regular expression.

Regular expressions deal with pattern matching. You want the function to find a particular pattern. The function then returns that pattern, or the stuff before it, or the stuff after it, or splits them appart, or squeezes them together. So what does this regular expression look for? The Parenthesis (): Tell the function this is a group of characters. [a-z]: Tell us they will be lower case letters.  : Tell us to look for one or more characters. That space between the ) and " Tells us the pattern ends in a space.

Thus reading down the string. T = Does not match [a-z] is a capital letter. h = Matches [a-z]. Starting Group i = Matches [a-z] s = Matches [a-z]

 = Matches space. First group found and is "his "

i = Matches [a-z]. Starting Group s = Matches [a-z]

 = Matches space. Second group found, and is "is "

a = Matches [a-z]. Starting Group

 = Matches space. Third group found, and is "a "

t = Matches [a-z]. Starting Group e = Matches [a-z] s = Matches [a-z] t = Matches [a-z] End of line. No more matches. Stop.

Thus, trusting the post, the map would be:

test[0][0] => "his " test[0][1] => "his" test[1][0] => "is " test[1][1] => "is" test[2][0] => "a " test[2][1] => "a"

I personally haven't used it. Would be used in parsing a page by hand.