|
Topic: DMD0166 STRFIND - Find within String |
|
|
|
|
|
The Find within String (STRFIND) instruction will search the target
string for a match to a second String or a string
literal
If the specified 'Search from' is 'Beginning to end', and the STRFIND operation is successful, the 'Where Found' value can be used programmatically as the Offset value in the Get Sub-String (STRSUB), Delete Sub-String (STRDELETE), and Insert Sub-String (STRINSERT) instructions. |
|
Parameters:Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.
Find within - this can be any String element.
Search From
- designates the direction of the search
Case Sensitive
- designates whether the case of the characters is relevant in the comparison
In Offset:
Start
As the input parameter (In Offset: Start) specifies the character offset into the Find within string to begin the search.
As the output parameter (Out Offset: Where Found) stores the character offset in the Find within String where the Find Text/String was found if the STRFIND operation was successful. If there are multiple potential matches, this will contain the offset of the first match. The offset value is relative to the end of the String where the search begins. For example, if the String SS0 contains "ABCDEFG", a STRFIND that searched for "C" will find it at fffset 3 when searching from 'Beginning to end', but will find it at offset 5 when searching from 'End to beginning'.
Both the In Offset: Start and Out Offset: Where Found values are 0-based.
If no match is found this value will be set to -1.
Set If Found - select this option to have the designated bit set ON if a match is found. This can be any writable bit location.
Set If Not Found - select this option to have the designated bit set ON if a match is not found. This can be any writable bit location.
Find
Text/String - is the text to look for in the Find
within String. This can be any String element, or a string literal
|
|
|
|
|
Status Display:The Status display of the Find within String instruction will only display as many of the characters of the Find within String and Find Text/String as will fit within the borders of the instruction, typically this is about 50 characters.
The gray triangle at the right end of an input leg indicates the input
is edge
triggered
|
|
|
|
|
See Also:
|
|
|
|
|
Related Topics:
String Scripting Language Reference
|
|
|
|
|
Example:
|
|
|
|
|