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"" |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 41: | Line 41: | ||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
| Line 49: | 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 73: | 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 107: | 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 141: | 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 175: | 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 209: | 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 243: | 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 272: | 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 301: | 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 335: | 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 364: | 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 393: | 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 415: | Line 421: | ||
|- | |- | ||
| colspan="2" | Index location in the string to insert the data | | 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="mtx-class-macrotable wikitable" | |||
|- | |||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | |||
| 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. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| 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" | Address in the source to start copying data | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| 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 values to copy from the source to the destination | |||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
| Line 422: | 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 451: | 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 480: | 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 506: | Line 551: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
==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 |