Difference between revisions of "Extract meat"

From Kolmafia
Jump to navigation Jump to search
imported>Slyz
(removed RFI - no other matches will work)
imported>Bale
m
Line 5: Line 5:
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=String Handling Routines|
 
  
 
function1={{Function|
 
function1={{Function|
Line 23: Line 22:
 
special=This function returns 0 if it does not find a match.
 
special=This function returns 0 if it does not find a match.
 
}}
 
}}
 +
 +
[[Category:String Handling Routines]]

Revision as of 05:09, 22 May 2010

needs(code_samples);

Function Syntax

int extract_meat(string text )

  • text is the string to search

This function searches your supplied text, searching for either the phrase "You gain X Meat" or "You lose X Meat" and returns X. For "gain" X will be positive, and for "lose" negative. The number X can be formatted with or without commas. Note that the phrases to search are both case-sensitive (it will not match on "You gain 10 meat"). This function can be used for parsing meat gains and losses from combat and kmails (though additional parsing is necessary for kmail to avoid considering the text of the kmail itself, which could contain the meat gain/loss string).

See Also

extract_items()

Special

This function returns 0 if it does not find a match.