Talk:String Handling Routines

From Kolmafia
Revision as of 10:51, 26 October 2007 by 47.230.0.45 (talk)
Jump to navigation Jump to search

Verga Gioiello bracciale tennis Test intelligenza gratis Gongolocom Venaria reale Pandamoviescom Hotel spoleto Foto puttanelle Vip uomini nudi Altamura Pescara calcio Traduci testi Polinesia francese tahiti attrazioni Kelis Affitta casa calabria it Collant sexy Stock fallimento Www banca intesa it Maglioni Ischia albergo terme H2210 Chat porno Prenotazione albergo venezia Portogruaro pensione completa barcellona La fata carabina Canzoni zecchino d oro Pasticceria Shitting smut Racconto eros tuttinudi Ombrellone snodo Pubblicita deodorante Gay strip Senewebcom Foto sexy Bocchino amatoriali Distributori automatici snack Caravelle Trampi it Video asia d argento Fiat panda Meteo previsioni satellite Www sexyvip tv Prestito villafranca d asti Canon digital ixus i Folletto vorwerk Gloryhole gallery Female domination Voli savona Casalinghe maggiorate Albergo economici lisbona Promozioni auto nuove Voli economici thailandia La casa dalle finestra che ridono Colorare disegni per bambini Natura romanticismo Casalinghe amatoriali Bicocca Grammatica online Sexi video Nudo di maschio Copertina ita ps2 Studentesse puttane Donne vogliose video Stabilizzatore ottico sony foto camera Rulliere nastro trasportatori Albergo sydney Shyla stylez mr big dick s hot chick hot Ainett stephens calendario Crea nomi glitterati Ciccione nude gratis Caminetto esterno Foto porno disney Gulliver concorso rcs it Aldo carpi Ragazze nude tedesche Crociera it Sexy bikini model Congelatore verticale alaska Weight watchers Giordania Nikki blond Acquisto personal computer Modem adsl router wireless Incontri campania Licata Foto mature hard Peuterey abbigliamento Video justine mattera Calcio storia Decathlon it Modem asus isdn Annuncio cuori solitari Elisabetta ferri nuda Foto donne amatoriali Apartment dallas rental uptown Monte conero Significato rosa blu Loredana lecciso nuda spiderman 2 al r dwl g122 scarpe da sposa sea glider bounce blue nikon 70 300 mm leslie sob love bugs ferro a secco helen lacie safe classroom2 bmw touring 330xd photos of andrea teenie sexxx dec 21 telecom base dect maxtor ethernet philips 201b40 21 guns n roses mp3 acer tm 382tmi skiman x600 pro all in wonder catsong ligth my fire lcd 3 ased geforce fx5500 256mb tv su notebook beatles tab babalawo az sanyo suomi24 fi funy sex cats asus a4l yety sports 2 epox 9npa screenplay 5000 mambo hempstead hilux toyota index they not gona get us teflon cortan hp t3030 nokia pbx url eh 53 master card pooh dvd fewest.cn napes.cn mp3 apple dadamo com booker t index www esmas com mx voice tracer philips duck hunt video gf inglese frase laurea gruppo energy protector www ogrisch com z750 record of lodoss war link the beat fleet suba club sex julie strain zeuglodon homepage topo asus p5wd2 premium wifi tv Gay huge cock mustek h140 gasca aspira acqua vasca da bagno fewest.cn denudos et l2908 104 nec dvd rende site basket nba bose hi fi kenny drew huy 82 fra w w w ultrablue cam wonderful sea cd cover pooh fire man dvd a hanging rock smart forfour dragostea don tei anniversary party 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.