How to remove particular words from a string

4,781 views
Skip to first unread message

rajesh sivasubramanian

unread,
Jul 28, 2015, 2:16:01 AM7/28/15
to robotframework-users
Hi,
   I am new to Robot Framework and  I need to remove some words from a string.I tried using 'Remove String Using Regexp' and 'Remove String' but it looks like I am missing something here.
The string is  ' 50573) by p4'  (without the quotes.There is a space before 50573).

I only need the number -50573 and the rest needs to be removed.Your help is appreciated !! .


Regards,
Rajesh

Tatu Aalto

unread,
Jul 28, 2015, 2:47:31 PM7/28/15
to wifa...@gmail.com, robotframework-users
Ugh

There are many keywords in the String library [1], which can solve the issue in many ways. Example like this:
*** Settings ***
Library           String

*** Test Cases ***
Example
    ${string}=    String.Fetch From Left
    ...    ${SPACE}50573) by p4
    ...    )
    ${string}=    String.Replace String
    ...    ${string}
    ...    ${SPACE}
    ...    ${EMPTY}
    Log    ${string}


-Tatu
[1] http://robotframework.org/robotframework/latest/libraries/String.html
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages