Difference between revisions of "Component: Advanced String Functions (Utility)"
(13 intermediate revisions by 2 users not shown) | |||
Line 23: | Line 23: | ||
==Detailed description== | ==Detailed description== | ||
+ | ===Explode=== | ||
+ | The explode functions use a delimiter to split a string up into an array. | ||
− | '' | + | For example "1,2,3,4" using the delimiter ',' would create {1,2,3,4}. |
+ | |||
+ | ===Implode=== | ||
+ | |||
+ | The implode functions do the reverse and create a string from an array. | ||
+ | |||
+ | for example {1,2,3,4} using the delimiter ',' would create "1,2,3,4". | ||
+ | |||
+ | |||
+ | All of the string functions assume that your string variable is large enough to store the data being passed into it. Overflowing the bounds of the string could lead to RAM corruption which could effect the operation of your program. | ||
==Examples== | ==Examples== | ||
+ | |||
+ | ''<span style="color:red;">No additional examples</span>'' | ||
+ | |||
+ | |||
+ | |||
− | |||
Line 39: | Line 54: | ||
==Macro reference== | ==Macro reference== | ||
+ | ===Contains=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Contains''' |
+ | |- | ||
+ | | colspan="2" | Scans a string to see if it contains a specific substring. Returns 1 if found, otherwise returns 0. | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
+ | | width="90%" | StrData | ||
|- | |- | ||
+ | | colspan="2" | Data string to scan | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
− | | width="90%" | | + | | width="90%" | StrMatch |
+ | |- | ||
+ | | colspan="2" | String to look for in the data | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===ExplodeToByteArray=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ExplodeToByteArray''' | ||
+ | |- | ||
+ | | colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of bytes. Returns the number of values discovered and placed into the DataArray, e.g. "1,2,3,4" would become {1,2,3,4} | ||
|- | |- | ||
− | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
− | | width="90%" | | + | | width="90%" | StringInput |
+ | |- | ||
+ | | colspan="2" | Data string e.g. "1,2,3,4" | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Delimiter | ||
+ | |- | ||
+ | | colspan="2" | Delimiting character byte for example ',' | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | DataArray | ||
|- | |- | ||
− | | colspan="2" | Data to | + | | colspan="2" | Data array to hold the numberic values found |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | MaxCount |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Maximum number of values to return |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===ExplodeToFloatArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ExplodeToFloatArray''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of floats Returns the number of values discovered and placed into the DataArray, e.g. "1.1,2.2,3.3,4.4" would become {1.1,2.2,3.3,4.4} |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
− | | width="90%" | | + | | width="90%" | StringInput |
+ | |- | ||
+ | | colspan="2" | Data string e.g. "1,2,3,4" | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Delimiter | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Delimiting character byte for example ',' |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT |
− | | width="90%" | | + | | width="90%" | DataArray |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Data array to hold the numberic values found |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | MaxCount |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Maximum number of values to return |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
Line 95: | Line 146: | ||
+ | ===ExplodeToINTArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ExplodeToINTArray''' |
|- | |- | ||
− | | colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of | + | | colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of integers. Returns the number of values discovered and placed into the DataArray, e.g. "1,2,3,4" would become {1,2,3,4} |
|- | |- | ||
|- | |- | ||
Line 113: | Line 165: | ||
| colspan="2" | Delimiting character byte for example ',' | | colspan="2" | Delimiting character byte for example ',' | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
| width="90%" | DataArray | | width="90%" | DataArray | ||
|- | |- | ||
Line 128: | Line 180: | ||
+ | ===ExplodeToStringArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 161: | Line 214: | ||
+ | ===FormattedStringFloat=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FormattedStringFloat''' |
+ | |- | ||
+ | | colspan="2" | Converts a floating point value to a string of a fixed size. The value 5 with a length of 3 and a character of '0' would generate "003" | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT |
+ | | width="90%" | Value | ||
|- | |- | ||
+ | | colspan="2" | value to format | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | MinLength |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | The minimum length you want the string to be |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | PaddChar |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Added character to padd the string with e.g. ' ' or '0' |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Precision |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of decimal points to add |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | ||
Line 189: | Line 248: | ||
+ | ===FormattedStringINT=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FormattedStringINT''' |
+ | |- | ||
+ | | colspan="2" | Converts a signed int to a string of a fixed size. The value 5 with a length of 3 and a character of '0' would generate "003" | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT |
+ | | width="90%" | Value | ||
|- | |- | ||
+ | | colspan="2" | value to format | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | MinLength |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | The minimum length you want the string to be |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | PaddChar |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Added character to padd the string with e.g. ' ' or '0' |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===ImplodeFromByteArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ImplodeFromByteArray''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Creates an ASCII string from an array of byte values. Places a delimiter in between each value. e.g. {1,2,3,4} would become "1,2,3,4" |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | DataArray |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | Count |
|- | |- | ||
− | | colspan="2" | Number of | + | | colspan="2" | Number of values held in the array |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | Delimiter |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Delimiter to add between values |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===ImplodeFromFloatArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ImplodeFromFloatArray''' |
+ | |- | ||
+ | | colspan="2" | Creates an ASCII string from an array of float values. Places a delimiter in between each value. e.g. {1.1,2.2,3.3,4.4} would become "1.1,2.2,3.3,4.4" | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT |
+ | | width="90%" | DataArray | ||
|- | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | Count |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of values held in the array |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | Delimiter |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Delimiter to add between values |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | Precision |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of decimal points to add to each float value |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===ImplodeFromINTArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ImplodeFromINTArray''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Creates an ASCII string from an array of integer values. Places a delimiter in between each value. e.g. {1,2,3,4} would become "1,2,3,4" |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | DataArray |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | Count |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of values held in the array |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | Delimiter |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Delimiter to add between values |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===ImplodeFromStringArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 329: | Line 398: | ||
+ | ===InsertInto=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''InsertInto''' |
+ | |- | ||
+ | | colspan="2" | Inserts a string into another string at the specified index position. | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
+ | | width="90%" | DataString | ||
|- | |- | ||
+ | | colspan="2" | Data string to ammend | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
− | | width="90%" | | + | | width="90%" | Insert |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Data to insert |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | InsertionIndex |
+ | |- | ||
+ | | colspan="2" | Index location in the string to insert the data | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===MemCopy=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MemCopy''' | ||
+ | |- | ||
+ | | colspan="2" | Allows an array of bytes to be copied into another array of bytes at the chosen start address. | ||
|- | |- | ||
− | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | SourceData |
+ | |- | ||
+ | | colspan="2" | Source data to copy from | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | SourceStartAddress | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Address in the source to start copying data |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | DestinationData |
+ | |- | ||
+ | | colspan="2" | Data to copy the values into | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | DestinationStartAddress | ||
+ | |- | ||
+ | | colspan="2" | Address in the destination to start inserting data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | NumBytes | ||
|- | |- | ||
− | | colspan="2" | Number of | + | | colspan="2" | Number of values to copy from the source to the destination |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===PositionOf=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PositionOf''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Scans a string to see if it contains a specific substring. Returns the location in the string if found, otherwise returns -1. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
− | | width="90%" | | + | | width="90%" | StrData |
|- | |- | ||
− | | colspan="2" | Data string | + | | colspan="2" | Data string to scan |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
− | | width="90%" | | + | | width="90%" | StrMatch |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | String to look for in the data |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | SearchFrom |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Starting index for the search, default 0. |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===RemoveFrom=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RemoveFrom''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Allows a set number of characters to be removed from a starting location in a string. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
− | | width="90%" | | + | | width="90%" | DataString |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Data string to ammend |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
− | | width="90%" | | + | | width="90%" | CharsToRemove |
|- | |- | ||
− | | colspan="2" | Number of | + | | colspan="2" | Number of characters to remove from the string |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | StartingIndex |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Index location in the string to delete the data |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
+ | ===SearchAndReplace=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SearchAndReplace''' | ||
+ | |- | ||
+ | | colspan="2" | Attempts to find a specific string inside the data string and if found replaces with the provided replacement string. Returns the number of times the search pattern was found. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | StrData | ||
+ | |- | ||
+ | | colspan="2" | Data string to scan | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | StrSearch | ||
+ | |- | ||
+ | | colspan="2" | String to look for in the data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | StrReplace | ||
+ | |- | ||
+ | | colspan="2" | String to insert into the data | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
Latest revision as of 12:03, 14 April 2023
Author | Matrix TSL |
Version | 1.0 |
Category | Utility |
Contents
- 1 Advanced String Functions component
- 2 Component Source Code
- 3 Detailed description
- 4 Examples
- 5 Macro reference
- 5.1 Contains
- 5.2 ExplodeToByteArray
- 5.3 ExplodeToFloatArray
- 5.4 ExplodeToINTArray
- 5.5 ExplodeToStringArray
- 5.6 FormattedStringFloat
- 5.7 FormattedStringINT
- 5.8 ImplodeFromByteArray
- 5.9 ImplodeFromFloatArray
- 5.10 ImplodeFromINTArray
- 5.11 ImplodeFromStringArray
- 5.12 InsertInto
- 5.13 MemCopy
- 5.14 PositionOf
- 5.15 RemoveFrom
- 5.16 SearchAndReplace
- 6 Property reference
Advanced String Functions component
A component designed to add more advanced functions to the existing built-in string library.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_AdvancedStringFunctions.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_AdvancedStringFunctions.fcfx
Detailed description
Explode
The explode functions use a delimiter to split a string up into an array.
For example "1,2,3,4" using the delimiter ',' would create {1,2,3,4}.
Implode
The implode functions do the reverse and create a string from an array.
for example {1,2,3,4} using the delimiter ',' would create "1,2,3,4".
All of the string functions assume that your string variable is large enough to store the data being passed into it. Overflowing the bounds of the string could lead to RAM corruption which could effect the operation of your program.
Examples
No additional examples
Macro reference
Contains
ExplodeToByteArray
ExplodeToFloatArray
ExplodeToINTArray
ExplodeToStringArray
FormattedStringFloat
FormattedStringINT
ImplodeFromByteArray
ImplodeFromFloatArray
ImplodeFromINTArray
ImplodeFromStringArray
InsertInto
MemCopy
PositionOf
RemoveFrom
SearchAndReplace
Property reference
![]() |
Properties |