Extract meat: Difference between revisions
imported>StDoodle Created page with '{{ #vardefine:name|extract_meat}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function_category=String Handling Routines| function1={{Function| name={{#v…' |
imported>Zarqon mNo edit summary |
||
Line 16: | Line 16: | ||
}}| | }}| | ||
function_description=This function searches your supplied {{pspan|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 | function_description=This function searches your supplied {{pspan|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)).| | ||
needscode=yes| | needscode=yes| |
Revision as of 03:42, 17 April 2010
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
Special
This function returns 0 if it does not find a match.
Attention KoLmafia Experts!
We need your help; some details of this function's operation are unknown or unclear.
The following specific question has been raised:
- Are there any additional matches that will be found by this function?