| 1 | <section id="stringmanipulate"> |
| 2 | <title>String Manipulation Opcodes</title> |
| 3 | <para>These opcodes perform operations on string variables (note: most of the opcodes run at init time only, and have a version with a "k" suffix that runs at both init and performance time; exceptions to this rule include puts and strget):</para> |
| 4 | <itemizedlist> |
| 5 | <listitem><para> |
| 6 | <link linkend="evalstr"><citetitle>evalstr</citetitle></link> - Evaluates a string containing Csound code, returning a value.</para> |
| 7 | </listitem> |
| 8 | <listitem><para> |
| 9 | <link linkend="return"><citetitle>return</citetitle></link> - Returns a value from an instrument.</para> |
| 10 | </listitem> |
| 11 | <listitem><para> |
| 12 | <link linkend="strcpy"><citetitle>strcpy</citetitle></link> and <link linkend="strcpyk"><citetitle>strcpyk</citetitle></link> - Assigns to a string variable.</para> |
| 13 | </listitem> |
| 14 | <listitem><para> |
| 15 | <link linkend="strcat"><citetitle>strcat</citetitle></link> and <link linkend="strcatk"><citetitle>strcatk</citetitle></link> - Concatenates strings, and stores the result in a variable.</para> |
| 16 | </listitem> |
| 17 | <listitem><para> |
| 18 | <link linkend="strcmp"><citetitle>strcmp</citetitle></link> and <link linkend="strcmpk"><citetitle>strcmpk</citetitle></link> - Compares strings.</para> |
| 19 | </listitem> |
| 20 | <listitem><para> |
| 21 | <link linkend="strget"><citetitle>strget</citetitle></link> - Assigns to a string variable, from strset table at the specified index, or string score p-field.</para> |
| 22 | </listitem> |
| 23 | <listitem><para> |
| 24 | <link linkend="strlen"><citetitle>strlen</citetitle></link> and <link linkend="strlenk"><citetitle>strlenk</citetitle></link> - Returns the length of a string.</para> |
| 25 | </listitem> |
| 26 | <listitem><para> |
| 27 | <link linkend="sprintf"><citetitle>sprintf</citetitle></link> - printf-style formatted output conversion, storing the result in a string variable.</para> |
| 28 | </listitem> |
| 29 | <listitem><para> |
| 30 | <link linkend="sprintfk"><citetitle>sprintfk</citetitle></link> - printf-style formatted output conversion, storing the result in a string variable at k-rate.</para> |
| 31 | </listitem> |
| 32 | <listitem><para> |
| 33 | <link linkend="puts"><citetitle>puts</citetitle></link> - Prints a string constant or variable.</para> |
| 34 | </listitem> |
| 35 | <listitem><para> |
| 36 | <link linkend="strindex"><citetitle>strindex</citetitle></link> and <link linkend="strindexk"><citetitle>strindexk</citetitle></link> - Returns the first occurence of a string in another string.</para> |
| 37 | </listitem> |
| 38 | <listitem><para> |
| 39 | <link linkend="strrindex"><citetitle>strrindex</citetitle></link> and <link linkend="strrindexk"><citetitle>strrindexk</citetitle></link> - Returns the last occurence of a string in another string.</para> |
| 40 | </listitem> |
| 41 | <listitem><para> |
| 42 | <link linkend="strsub"><citetitle>strsub</citetitle></link> and <link linkend="strsubk"><citetitle>strsubk</citetitle></link> - Returns a substring of the input string.</para> |
| 43 | </listitem> |
| 44 | <listitem><para> |
| 45 | <link linkend="strstrip"><citetitle>strstrip</citetitle></link> - Strip whitespace from string.</para> |
| 46 | </listitem> |
| 47 | </itemizedlist> |
| 48 | |
| 49 | <para><link linkend="strfromurl"><citetitle>strfromurl</citetitle></link> sets a string variable at initialization time to the value found from reading an URL.</para> |
| 50 | </section> |