Difference between revisions of "String Handling Routines"
Jump to navigation
Jump to search
imported>StDoodle m (moved (ASHRM) String Handling Routines to String Handling Routines over redirect) |
imported>StDoodle |
||
Line 1: | Line 1: | ||
− | + | {{Flink||void|print|string|{{opt|string}}|desc=Prints the given string to the CLI and status line, optionally in the specified color.}} | |
− | + | {{Flink|string|visit_url|string|desc=Visits the specified address and returns the page source (see page for details).}} | |
− | + | {{Flink|string|location_to_url|location|desc=Returns the url which is accessed to visit the specified location.}} | |
− | Prints the given string to the | + | {{Flink|boolean|contains_text|string|string|desc=Returns true if the second string is found as a substring of the first.}} |
− | + | {{Flink|int|extract_meat|string|desc=Returns the number of meat embedded in a string.}} | |
− | + | {{Flink|int [item]|extract_items|desc=Parses a string for items and their amounts (handles plural & singular forms) and returns the results as a map.}} | |
− | + | {{Flink|int|length|string|desc=Returns the number of characters in the specified string.}} | |
− | + | {{Flink|int|index_off|string|string|{{opt|int}}|desc=Returns the position of the second string in the first (or -1 if not found), optionally starting from a given position.}} | |
− | Returns the | + | {{Flink|int|last_index_of|string|string|desc=Returns the last index of the second string in the first.}} |
− | + | {{Flink|string|substring|string|int|{{opt|int}}|desc=Returns the substring of the specified string, starting from a specified position, and optionally ending at a specified position (defaults to remainder of string).}} | |
− | + | {{Flink|string|replace_string|string|string|string|desc=Replaces all text in the first string that matches the second with the third.}} | |
− | + | {{Flink|string|url_encode|string|desc=Converts a string into a URL formatted string.}} | |
− | Returns the | + | {{Flink|string|url_decode|string|desc=Converts a URL formatted string into regular text.}} |
− | + | {{Flink|string [int]|split_string|string|{{opt|rstring}}|desc=Splits apart the first string at line-breaks or using an optionally supplied delimeter and returns an integer-keyed map of the result.}} | |
− | + | {{Flink|string [int,int]|group_string|string|string|desc=This does... something regex-y. I dunno. [http://kolmafia.us/showthread.php?t=318]}} | |
− | + | {{Flink|string [int]|session_logs|{{opt|string}}|int|desc=Gives access to sessions logs. And stuff. [http://kolmafia.us/showthread.php?t=573]}} | |
− | Returns the | + | {{Flink|buffer|append|buffer|string|desc=Appends the string to the end of the buffer.}} |
− | + | {{Flink|buffer|append_tail|matcher|buffer|desc=Appends the text returned by a matcher to the end of the buffer.}} | |
− | |||
− | Returns the | ||
− | |||
− | |||
− | |||
− | Returns the last index | ||
− | |||
− | |||
− | |||
− | |||
− | Returns the substring of the | ||
− | |||
− | |||
− | |||
− | |||
− | Converts a string | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Gives access to | ||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 04:51, 3 March 2010
void( print, string, [string] )
Prints the given string to the CLI and status line, optionally in the specified color.
string visit_url( string )
Visits the specified address and returns the page source (see page for details).
string location_to_url( location )
Returns the url which is accessed to visit the specified location.
boolean contains_text( string, string )
Returns true if the second string is found as a substring of the first.
Returns the number of meat embedded in a string.
int [item] extract_items()
Parses a string for items and their amounts (handles plural & singular forms) and returns the results as a map.
int length( string )
Returns the number of characters in the specified string.
int index_off( string, string, [int] )
Returns the position of the second string in the first (or -1 if not found), optionally starting from a given position.
int last_index_of( string, string )
Returns the last index of the second string in the first.
string substring( string, int, [int] )
Returns the substring of the specified string, starting from a specified position, and optionally ending at a specified position (defaults to remainder of string).
string replace_string( string, string, string )
Replaces all text in the first string that matches the second with the third.
string url_encode( string )
Converts a string into a URL formatted string.
string url_decode( string )
Converts a URL formatted string into regular text.
string [int] split_string( string, [rstring] )
Splits apart the first string at line-breaks or using an optionally supplied delimeter and returns an integer-keyed map of the result.
string [int,int] group_string( string, string )
This does... something regex-y. I dunno. [1]
string [int] session_logs( [string], int )
Gives access to sessions logs. And stuff. [2]
buffer append( buffer, string )
Appends the string to the end of the buffer.
buffer append_tail( matcher, buffer )
Appends the text returned by a matcher to the end of the buffer.