FIND (Find Substring Position)
Searches for the first occurrence of substring IN2 within string IN1 and writes the 1-based starting character index (0 if not found) to the target INT variable.
Description
FIND locates src2 (IN2) inside src1 (IN1):
- If
IN2is found, the target variable receives its 1-based starting position (1,2, ...). - If
IN2is not present inIN1, the target variable receives0.
Syntax
- variable_name: Target
INTvariable receiving the 1-based position - qualifier: Typically
ActionQualifier.P(Pulse) - instruction:
ActionInstruction.FIND - src1 (
IN1): String to search within (STRINGvariable or literal) - src2 (
IN2): Substring to search for (STRINGvariable or literal)
Sequence Visual Editor
- Select an action on a step or transition and hold Alt (or right-click -> Edit Qualifier & Instruction).
- Select Strings -> FIND and choose the P qualifier.
- Fill in the target
INTvariable, source string (IN1), and search substring (IN2).
Python
from automation_machine import ActionQualifier, ActionInstruction
step.add_action("delim_pos", "Find delimiter index", qualifier=ActionQualifier.P, instruction=ActionInstruction.FIND, src1="barcode", src2='"-"')