62 lines
2.1 KiB
HTML
62 lines
2.1 KiB
HTML
<html>
|
|
<head>
|
|
<title>STAB_GetElemByFloat</title>
|
|
<meta name="Author" content="Joey">
|
|
<link rel="stylesheet" type="text/css" href="../webdocs.css">
|
|
</head>
|
|
<body>
|
|
<h1><a name="ape_stab_getelembyfloat"></a>STAB_GetElemByFloat</h3>
|
|
<p>The <b>STAB_GetElemByFloat</b> function returns a string stored
|
|
with a specific float value in a STAB object.</p>
|
|
|
|
<PRE class="syntax"><b>extern STAB_GetElemByFloat</b>
|
|
<b> float</b><i> handle</i> // handle to STAB
|
|
<b> float</b><i> searchval</i> // search value
|
|
<b> stringvar</b><i> strdata$</i> // string variable to receive matching string
|
|
<b> floatvar</b><i> index</i> // float variable to receive matching string's index
|
|
</PRE>
|
|
|
|
<h4>Parameters</h4>
|
|
|
|
<dl>
|
|
<dt><i>handle</i></dt>
|
|
<dd>[in] Handle to a STAB object previously returned from
|
|
<a href="stab_create.html"><b>STAB_Create</b></a>.
|
|
</dd>
|
|
<dt><i>value</i></dt>
|
|
<dd>[in] The associated value to find in the STAB object.</dd>
|
|
<dt><i>strdata$</i></dt>
|
|
<dd>[out] The string variable that will be set with the first string
|
|
that has an associated float value of <i>searchval</i>.</dd>
|
|
<dt><i>index</i></dt>
|
|
<dd>[out] The float variable that will be set with the index
|
|
of the matching string, or -1 if a match was not found.
|
|
</dl>
|
|
|
|
<h4>Remarks</h4>
|
|
<p>If <i>handle</i> is not a valid STAB handle, an error message will
|
|
be printed to the console.</p>
|
|
|
|
<p><b>STAB_GetElemByFloat</b> compares the value of <i>searchval</i>
|
|
with each string's associated float value. It returns the first
|
|
matching index, if one exists.</p>
|
|
|
|
<p>To perform a search that matches associated values rounded to the
|
|
nearest integer, use
|
|
<a href="stab_getelembyint.html"><b>STAB_GetElemByInt</b></a>.
|
|
|
|
<h4>Example</h4>
|
|
|
|
<pre>extern STAB_Create handle
|
|
extern STAB_Append handle "a" 0.3
|
|
extern STAB_Append handle "b" 1.5
|
|
extern STAB_Append handle "c" 2.1
|
|
extern STAB_GetElemByInt handle 1.5 str$ idx
|
|
</pre>
|
|
|
|
<p>At the end of this code fragment, str$ will have a value of "b"
|
|
and idx will have a value of 1.</p>
|
|
|
|
</body>
|
|
</html>
|