How to get the text before and after certain word in a string.

Hi All,

I have a scenario where i need to get the text before and after certain word in a string.

Ex: 
put "Hi i am new to eggplant automation and started learning the tool" into variable1.

Now i need the text before and after the word "Automation" into separate variable. 

Any help on this would be great
Tagged:

Comments

  • MartinBrMartinBr Member
    Hi VinayKumarCV,

    You could try making a copy of the variable and then using delete to remove the word "automation" like this:
    put variable1 into variable2
    delete "automation" from variable2

    Here's the documentation: delete command
  • DaveHesterDaveHester Member
    This may be a solution for you as well:
    put "Hi i am new to eggplant automation and started learning the tool" into variable1
    put split(variable1,"automation") into variableList
    log item 1 of variableList
    log item 2 of variableList
Sign In or Register to comment.