Difference between revisions of "To thrall"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(to_thrall)
 
imported>Eliteofdelete
 
Line 23: Line 23:
 
function_description=When supplied an int or string, returns the thrall that corresponds to the specified parameter {{pspan|convert}}. Matching for the string is fuzzy.|
 
function_description=When supplied an int or string, returns the thrall that corresponds to the specified parameter {{pspan|convert}}. Matching for the string is fuzzy.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=Following example shows basic to_thrall operations.||
 +
code=
 +
<syntaxhighlight>
 +
int first;
 +
string second, third;
 +
 
 +
first = 3;
 +
second = "dread";
 +
third = "ver";
 +
 
 +
print(first+" gives "+to_thrall(first)+".", "blue");
 +
print(second+" gives "+to_thrall(second)+".", "blue");
 +
print(third+" gives "+to_thrall(third)+".", "blue");
 +
</syntaxhighlight>|
 +
moreinfo=
 +
It gives the following output.
 +
<pre>
 +
3 gives Angel Hair Wisp.
 +
dread gives Penne Dreadful.
 +
ver gives Vermincelli.
 +
</pre>
 +
}}|
  
 
special=If no match is found for a supplied string or int type, this function returns $thrall[ none ].|
 
special=If no match is found for a supplied string or int type, this function returns $thrall[ none ].|

Latest revision as of 15:43, 26 January 2015

Function Syntax

thrall to_thrall(int convert )

thrall to_thrall(string convert )

When supplied an int or string, returns the thrall that corresponds to the specified parameter convert. Matching for the string is fuzzy.

Code Samples

Following example shows basic to_thrall operations.

int first;
string second, third;

first = 3;
second = "dread";
third = "ver";

print(first+" gives "+to_thrall(first)+".", "blue");
print(second+" gives "+to_thrall(second)+".", "blue");
print(third+" gives "+to_thrall(third)+".", "blue");

It gives the following output.

3 gives Angel Hair Wisp.
dread gives Penne Dreadful.
ver gives Vermincelli.

Special

If no match is found for a supplied string or int type, this function returns $thrall[ none ].