Talk:String Handling Routines

From Kolmafia
Revision as of 00:37, 4 October 2007 by 65.44.66.100 (talk)
Jump to navigation Jump to search

when you re smiling fullout ignis icfs23 sapore di mare 2 un anno dopo musica chilena donne nere nude lavoro campobasso katana shirasaya lettori divx combo nota spese epidurale nguyen hong nhung sex la lunga notte di lucignolo 2004 giochi francesi age of imperius toner epson 5800 se fossi re intreccio mortale yamaha r1 moto translate krugersdorp plasma 42 el firewire cardbus nomi reali tucarro com xd picture verbatim xxx arab girls vree and action linea77 fantasma tunturi t80f shake it mp3 download mangime gatto profumo armani mania hrmanita nba live 2005 fotos de chicas plei boy canon mv 850i videocamere deca sudi noi pupo bp 6m batteria nokia batterie per pinodaniele pigro paul mccartney music box biographical collection robot moulinex cucina titanic dvd webchat usb frontale git my heart nilza monteiro juanes taboo impianto hi riviste don bacchi dentro di te baroni latin put rammstein and amerika digital doc 5 ebony fuck incontrare uomo gayboys pensando enti ww gogle com cagnolini sonic advance scale alluminio karaoke buble la famiglia per freud voli thailandia card reader 6 1 yamaha pianocraft dark and night nikkor af 28200 3 55 6 d vegas las scheda video e cattura el 8 vietnam hotel cassago brianza genova 21 anni vera pelle odore di sborra borsa morbida canon pagate jvc dr mh20 ch checkit out computer doppio processore toelettatura animali brascia irdeto keys seagate hd hard disk cassetto tarzan boy baltimore drancy sistema home teatre der herr ist mit mir bond lettori portatili microonde whirlpool cottura a vapore interflora chieti hp 1215 multifunzione biglietti frasi invito battesimo gigabyte ska ivete sangalo lybra diesel dravite demenziali netgear wgps606fs troni e1 olympus venera segur de cala elkann wallstreet qualification mt 1075 offerta pc antivirus sitios akai campobasso jak zaponiec jennifer aniston topless stampanti canon ip 4000 biturbo spider lavastoviglie bosch sgs granita di anguria comune di asti tinka nere xxxx storage disk golf iv gti 150 tdi imoveis me encontraras dvix braun xp 5775 occasione chevrolet corvette djlover microsoft desktop cordless spartito flauto colonna sonora ace ventura batteria t68 partiture notturni moonlight lady palace hotel roma bici ciclismo graduatoria vfp1 esercito anno 2005 que tontos que locos paula jones vagabondo che son io media stage for av 100 sintonizzatore monitor corso di cartomanzia sigma 18200 brunello montalcino tabelle danno biologico comune di massa martana powershot 70 canon vip porno muccia digitale sony cybershot dsct5 cuffia cobra lettore dvd portatile 10 terza rivoluzione industriale facolta di biologia alessandria cisco ip phone 7940 i don t want to be abbondati pittura parietale inverter 12 ghoul panic enermax alimentatore il sorriso del grande tentatore serenissima remix oedipus orca forni micronde lampada da tavolo ruta rebelat locali lecce counter lara snc ingranaggi plastica maroon this love testo gps hamlet bluetooth elaborazione scooter the nreason dalla z allla a biglietti di invito per i 18 anni daewoo dv 700s un poliziotto scomodo samsung mp3 yh820 violenza per una giovane air max 2003 progres veneto televisori con dvd samsung tv box terrestre mosca tze tze high power flash hfdc1 chiudi chat vhs divx dvd home theatre jeans cavalli roberto sexo en la red morte di una stella le schiave di cartagine ford cayman blue tema su manzoni 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.