Component: Advanced String Functions (Utility): Difference between revisions
No edit summary |
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"" |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 55: | Line 55: | ||
===Contains=== | ===Contains=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Contains''' | ||
|- | |- | ||
| colspan="2" | Scans a string to see if it contains a specific substring. Returns 1 if found, otherwise returns 0. | | colspan="2" | Scans a string to see if it contains a specific substring. Returns 1 if found, otherwise returns 0. | ||
| Line 79: | Line 79: | ||
===ExplodeToByteArray=== | ===ExplodeToByteArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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} | | 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} | ||
| Line 113: | Line 113: | ||
===ExplodeToFloatArray=== | ===ExplodeToFloatArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ExplodeToFloatArray''' | ||
|- | |- | ||
| 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} | | 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} | ||
| Line 147: | Line 147: | ||
===ExplodeToINTArray=== | ===ExplodeToINTArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ExplodeToINTArray''' | ||
|- | |- | ||
| 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} | | 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 181: | Line 181: | ||
===ExplodeToStringArray=== | ===ExplodeToStringArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ExplodeToStringArray''' | ||
|- | |- | ||
| colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of strings. Returns the number of values discovered and placed into the DataArray, e.g. "1,2,3,4" would become {"1","2","3","4"} | | colspan="2" | Takes an ASCII string and using a delimiter converts it into an array of strings. Returns the number of values discovered and placed into the DataArray, e.g. "1,2,3,4" would become {"1","2","3","4"} | ||
| Line 215: | Line 215: | ||
===FormattedStringFloat=== | ===FormattedStringFloat=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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" | | 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" | ||
| Line 249: | Line 249: | ||
===FormattedStringINT=== | ===FormattedStringINT=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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" | | 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" | ||
| Line 278: | Line 278: | ||
===ImplodeFromByteArray=== | ===ImplodeFromByteArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ImplodeFromByteArray''' | ||
|- | |- | ||
| 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" | | 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" | ||
| Line 307: | Line 307: | ||
===ImplodeFromFloatArray=== | ===ImplodeFromFloatArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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" | | 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" | ||
| Line 341: | Line 341: | ||
===ImplodeFromINTArray=== | ===ImplodeFromINTArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ImplodeFromINTArray''' | ||
|- | |- | ||
| 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" | | 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" | ||
| Line 370: | Line 370: | ||
===ImplodeFromStringArray=== | ===ImplodeFromStringArray=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''ImplodeFromStringArray''' | ||
|- | |- | ||
| colspan="2" | Creates an ASCII string from an array of string values. Places a delimiter in between each value. e.g. {"1","2","3","4"} would become "1,2,3,4" | | colspan="2" | Creates an ASCII string from an array of string values. Places a delimiter in between each value. e.g. {"1","2","3","4"} would become "1,2,3,4" | ||
| Line 399: | Line 399: | ||
===InsertInto=== | ===InsertInto=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''InsertInto''' | ||
|- | |- | ||
| colspan="2" | Inserts a string into another string at the specified index position. | | colspan="2" | Inserts a string into another string at the specified index position. | ||
| Line 428: | Line 428: | ||
===MemCopy=== | ===MemCopy=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MemCopy''' | ||
|- | |- | ||
| colspan="2" | Allows an array of bytes to be copied into another array of bytes at the chosen start address. | | colspan="2" | Allows an array of bytes to be copied into another array of bytes at the chosen start address. | ||
| Line 467: | Line 467: | ||
===PositionOf=== | ===PositionOf=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''PositionOf''' | ||
|- | |- | ||
| colspan="2" | Scans a string to see if it contains a specific substring. Returns the location in the string if found, otherwise returns -1. | | colspan="2" | Scans a string to see if it contains a specific substring. Returns the location in the string if found, otherwise returns -1. | ||
| Line 496: | Line 496: | ||
===RemoveFrom=== | ===RemoveFrom=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''RemoveFrom''' | ||
|- | |- | ||
| colspan="2" | Allows a set number of characters to be removed from a starting location in a string. | | colspan="2" | Allows a set number of characters to be removed from a starting location in a string. | ||
| Line 525: | Line 525: | ||
===SearchAndReplace=== | ===SearchAndReplace=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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. | | 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. | ||
| Line 555: | Line 555: | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|} | |} | ||
Latest revision as of 14:22, 13 July 2026
| Author | Matrix TSL |
| Version | 1.0 |
| Category | Utility |
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 |