Is there a keyword defined that can break a word and returns its
letters into a list? The list of letters would be used for the "Press
Key Native" keyword.
Thanks!
I can't think of an existing keyword that would do that, but it is
very easy to do this in your own library.
1. create a file char_splitter.py and add this function there:
def split_chars(text):
return [c for c in text]
2. take this library into use
Library char_splitter.py
3. Profit!
- Jussi
--
Jussi Malinen / Robot Framework
Reaktor, www.reaktor.fi
> --
> You received this message because you are subscribed to the Google Groups "robotframework-users" group.
> To post to this group, send email to robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.
>
>
--
Jussi Malinen / Robot Framework
Reaktor, www.reaktor.fi
${string} = | Set Variable | NOW WITH SPACES
@{chararr} = | Evaluate | [ ch for ch in '${string}' ]
:FOR | ${letter} | IN | @{chrarr}
| # Do something with the letter here
Note that I'm using a single quote to delimit the string so, if your
string contains a single quote this won't work.
You may use triple quotes, but again, this doesnt work if a string
ends in a quote.
Hope it helps...
>
> --
> Jussi Malinen / Robot Framework
> Reaktor,www.reaktor.fi
>
> On Tue, Nov 22, 2011 at 5:10 PM, antonio III cabreira
>
>
>
>
>
>
>
>
>
> <antonio.cabreira...@gmail.com> wrote:
> > Hi All,
>
> > Is there a keyword defined that can break a word and returns its
> > letters into a list? The list of letters would be used for the "Press
> > Key Native" keyword.
>
> > Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups "robotframework-users" group.
> > To post to this group, send email to robotframe...@googlegroups.com.
> > To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/robotframework-users?hl=en.
>
> --
> Jussi Malinen / Robot Framework
> Reaktor,www.reaktor.fi
---
Guillermo
On Nov 24, 8:23 am, Jussi Malinen <jussi.ao.mali...@gmail.com> wrote:
> Hi Antonio!
>
> I can't think of an existing keyword that would do that, but it is
> very easy to do this in your own library.
>
Or you could achieve the same with-in RF. In your TC or a User
Keyword.
${string} = | Set Variable | NOW WITH SPACES
@{chararr} = | Evaluate | [ ch for ch in '${string}' ]
:FOR | ${letter} | IN | @{chrarr}
| # Do something with the letter here
Note: That I'm using single quotes to delimit the string, so if your
string contains a single quote you'd get SyntaxError.
Hope it helps,
Guillermo
There were already good replies on how to implement such keyword
yourself. Adding such a keyword into Strings library [1] so please
submit an issue [2] about it. Strings actually already has `Split
String` but it requires a delimiter. It would probably be best to
implement new `Split String To Characters` keyword than trying to
enhance the old one somehow.
[1] http://code.google.com/p/robotframework/wiki/StringLibrary
[2] http://code.google.com/p/robotframework/issues/list
Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
| Issue 1011: | Add keyword 'Split String To Characters' keyword |