RobotStudio event

Pieces of string

I have string variables used to identify and store data in specific .txt files. however i would like to use portions of that data to further organize my text files. but I'm not certain how to store a portion of a string as another string.


VAR string Searchname:="1067 Ladder_Pth1_R1_S23";
                         or          :="1067 Ladder_Pth7_R2_S2"
                         or          :="1080 Liftarms_Pth3_R1_S4"
                         or          :="1390 Liftarms_Pth6_R1_S1"

I would like to use the first 4 digits of Searchname as an identifier, say SearchID
How would i go about doing such a thing?

Something like:

VAR String SearchID := left4 of Searchname;

I'm just don't know the proper syntax


  • Use function StrPart, it will store the characters into another string variable.  You specify the start position and the length, which sounds just like what you are asking.
    Lee Justice
  • Totally worked, exactly what I needed. Thank you!!