String Handling Routines

From Kolmafia
Revision as of 09:12, 27 October 2007 by 82.111.20.202 (talk)
Jump to navigation Jump to search

modem adsl wireless netgear rimm non ecc www tvn c l home go kart firewire ide url tracce seconda prova 2004 map heavi loira www pornofilms be athlon 64 3000 box wiltz in auto kiersy cibus home porky lacie 20gb usb once again upa dance smallvill sony pcm rocks dragonmoon x power shot s2is bankruptcy edonkey2000 linux index legno balsa hordeum www overland com Francesca lodo foto link nikon f 801 wireless linux lcd lg 20la90 usb 2 wireless 54 mbps icecream car ss waffen blank dvds rayman good girls tomtom 400 lcd toshiba 20 peugeot rc flasch nike vapor jr larma amd 2000 dtl notebook gprs driver vt82c596b Francesco arca nudo site haboob greco suzuki moto pl rosenheim sou lseek home rhapsody in blue url link escor treviso site oki 5591 amd athlon 64 mobile yogi amd duron www linea blu www sfdk cl sega tampa san petersburg hotel juaquin cortez home easy port page deathrow logic 7 pro amd sempron 2400 tmf 2001 salacca medea cubase sx homepage milton guedes motoscafi a scoppio pisa dvd recorder secam remo bubbles shot hp pavilon 17 enrique feat kelis gargantua bost a move 2 hp q1247a e 730 router wireless belkin

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