String Handling Routines: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[http://modem-adsl-wireless-netgear.misserve.info/ modem adsl wireless netgear] [http://rimm-non-ecc.indulger.info/ rimm non ecc] [http://www-tvn-c-l.downslip.info/ www tvn c l] [http://indulger.info/index2_250.html home] [http://go-kart.downslip.info/ go kart] [http://firewire-ide.burblers.info/ firewire ide] [http://wrawler.info/index6_1000.html url] [http://tracce-seconda-prova-2004.stroam.info/ tracce seconda prova 2004] [http://unfeeble.info/index3_250.html map] [http://heavi.batswing.info/ heavi] [http://loira.batswing.info/ loira] [http://www-pornofilms-be.unfeeble.info/ www pornofilms be] [http://athlon-64-3000-box.misserve.info/ athlon 64 3000 box] [http://wiltz.wrawler.info/ wiltz] [http://in-auto.batswing.info/ in auto] [http://kiersy.indulger.info/ kiersy] [http://cibus.wrawler.info/ cibus] [http://downslip.info/index4_1000.html home] [http://porky.burblers.info/ porky] [http://lacie-20gb-usb.unfeeble.info/ lacie 20gb usb] [http://once-again-upa-dance.wrawler.info/ once again upa dance] [http://smallvill.indulger.info/ smallvill] [http://sony-pcm.indulger.info/ sony pcm] [http://rocks.downslip.info/ rocks] [http://dragonmoon-x.stroam.info/ dragonmoon x] [http://power-shot-s2is.wrawler.info/ power shot s2is] [http://bankruptcy.stroam.info/ bankruptcy] [http://edonkey2000-linux.unfeeble.info/ edonkey2000 linux] [http://indulger.info/index0_250.html index] [http://legno-balsa.burblers.info/ legno balsa] [http://hordeum.stroam.info/ hordeum] [http://www-overland-com.downslip.info/ www overland com] [http://francesca-lodo-foto.wrawler.info/ Francesca lodo foto] [http://downslip.info/index5_666.html link] [http://nikon-f-801.downslip.info/ nikon f 801] [http://wireless-linux.stroam.info/ wireless linux] [http://lcd-lg-20la90.downslip.info/ lcd lg 20la90] [http://usb-2-wireless-54-mbps.wrawler.info/ usb 2 wireless 54 mbps] [http://icecream-car.misserve.info/ icecream car] [http://ss-waffen.burblers.info/ ss waffen] [http://blank-dvds.downslip.info/ blank dvds] [http://rayman.burblers.info/ rayman] [http://good-girls.unfeeble.info/ good girls] [http://tomtom-400.burblers.info/ tomtom 400] [http://lcd-toshiba-20.stroam.info/ lcd toshiba 20] [http://peugeot-rc.unfeeble.info/ peugeot rc] [http://flasch.misserve.info/ flasch] [http://nike-vapor-jr.stroam.info/ nike vapor jr] [http://larma.batswing.info/ larma] [http://amd-2000.burblers.info/ amd 2000] [http://dtl.burblers.info/ dtl] [http://notebook-gprs.misserve.info/ notebook gprs] [http://driver-vt82c596b.indulger.info/ driver vt82c596b] [http://francesco-arca-nudo.misserve.info/ Francesco arca nudo] [http://indulger.info/index5_250.html site] [http://haboob.misserve.info/ haboob] [http://greco.burblers.info/ greco] [http://suzuki-moto.misserve.info/ suzuki moto] [http://pl.wrawler.info/ pl] [http://rosenheim.misserve.info/ rosenheim] [http://sou-lseek.misserve.info/ sou lseek] [http://wrawler.info/index5_1000.html home] [http://rhapsody-in-blue.downslip.info/ rhapsody in blue] [http://downslip.info/index6_666.html url] [http://downslip.info/index5_666.html link] [http://escor-treviso.misserve.info/ escor treviso] [http://misserve.info/index1_666.html site] [http://oki-5591.misserve.info/ oki 5591] [http://amd-athlon-64-mobile.misserve.info/ amd athlon 64 mobile] [http://yogi.misserve.info/ yogi] [http://amd-duron.misserve.info/ amd duron] [http://www-linea-blu.burblers.info/ www linea blu] [http://www-sfdk-cl.wrawler.info/ www sfdk cl] [http://sega.stroam.info/ sega] [http://tampa-san-petersburg-hotel.burblers.info/ tampa san petersburg hotel] [http://juaquin-cortez.stroam.info/ juaquin cortez] [http://stroam.info/index7_666.html home] [http://easy-port.stroam.info/ easy port] [http://batswing.info/index6_1000.html page] [http://deathrow.burblers.info/ deathrow] [http://logic-7-pro.wrawler.info/ logic 7 pro] [http://amd-sempron-2400.batswing.info/ amd sempron 2400] [http://tmf-2001.misserve.info/ tmf 2001] [http://salacca.wrawler.info/ salacca] [http://medea.batswing.info/ medea] [http://cubase-sx.unfeeble.info/ cubase sx] [http://indulger.info/index1_666.html homepage] [http://milton-guedes.stroam.info/ milton guedes] [http://motoscafi-a-scoppio.misserve.info/ motoscafi a scoppio] [http://pisa.stroam.info/ pisa] [http://dvd-recorder-secam.unfeeble.info/ dvd recorder secam] [http://remo.misserve.info/ remo] [http://bubbles-shot.batswing.info/ bubbles shot] [http://hp-pavilon-17.misserve.info/ hp pavilon 17] [http://enrique-feat-kelis.downslip.info/ enrique feat kelis] [http://gargantua.downslip.info/ gargantua] [http://bost-a-move-2.stroam.info/ bost a move 2] [http://hp-q1247a.stroam.info/ hp q1247a] [http://e-730.indulger.info/ e 730] [http://router-wireless-belkin.batswing.info/ router wireless belkin]
== Part  8 - String Handling Routines ==
== Part  8 - String Handling Routines ==
<p><em>Under Construction</em></p>
<p><em>Under Construction</em></p>
Line 34: Line 33:
<p><strong>string url_encode( string text )</strong><br>
<p><strong>string url_encode( string text )</strong><br>
<strong>string url_decode( string text )</strong><br>
<strong>string url_decode( string text )</strong><br>
Converts a string text into a formatted string for using with raw URLs or from a formatted string back into “normal” text.</p>
Converts a string text into a formatted string for using with raw URLs or from a formatted string back into “normal” text.</p>


<p><strong>string [int] split_string( string source )</strong><br>
<p><strong>string [int] split_string( string source )</strong><br>

Revision as of 16:49, 27 October 2007

Part 8 - String Handling Routines

Under Construction

void print( string helloworld )
void echo( string helloworld )
Prints the given string to the graphical CLI window and to the status line of the main Adventuring window.

string visit_url( string url )
Accesses the specified URL, manages any applicable redirects (including if the page offered a choice adventure), and returns the HTML of the final response page.

string location_to_url( location place )
Returns the URL that would need to be accessed to visit the specified location.

boolean contains_text( string source, string query )
Reveals if the query string is a substring of the source string.

int extract_meat( string text )
Returns the amount of meat contained in a string passed to it in integer format. For use in k-mail parsing. *Not for use on pending trades.*

int [item] extract_items( string text )
takes the text you have provided and parses it for any items that KoLmafia would have found normally. This means you have access to the built-in pluralization handler as well as the ability to NOT have to lookup description IDs or whatever other loops you had to use to access that information. For use in k-mail parsing. *Not for use on pending trades.*

int length( string text )
Returns the length of the given string.

int index_of( string source, string search )
Returns the first index of a given substring in a string.
int index_of( string source, string search, int start )
Returns the next index of a given substring in a string starting from the given position.
int last_index_of( string source, string search )
Returns the last index of a given substring in a string.

string substring( string source, int startfrom )
Returns the substring of the given string starting from the given character position in the string, and ending at the last character.
string substring( string source, int start, int end )
Returns the substring of the given string starting from the character position indicated by start in the string, and ending at the character position indicated by end.

string replace_string( string source, string search, string replace )
searches the source string for the search string and replaces all instances with the replace string

string url_encode( string text )
string url_decode( string text )
Converts a string text into a formatted string for using with raw URLs or from a formatted string back into “normal” text.

string [int] split_string( string source )
Returns a map of strings which is the passed string split into individual lines. Originally implemented for use when parsing session logs, but may see more uses in the future. http://kolmafia.us/index.php/topic,794.msg3868.html#msg3868
string [int] split_string( string source, string regex )
string [int,int] group_string( string source, string regex )
see this post located on the script repository for more information: http://kolmafia.us/index.php/topic,451.msg2235.html#msg2235

string [int] session_logs( string player, int day_count ) Gives access to the session logs saved by kolmafia. More details will be added when this function's own page is written. For now, more extensive details can be found here: http://kolmafia.us/index.php/topic,794.msg3879.html#msg3879