Reply
Contributor
jefflee
Posts: 11
Registered: 10-10-2008
0
Accepted Solution

How to get one character at a time from a string?

Hi,

 

I have a number "set num 215" and I like to get one digit at a time (2, 1, 5). How do I do that?

In tcl, I can use "string index num 0" to get the first digit. And "string index num 1" to get the second digit. ...

 

How can I do this in iTest?

 

-Jeffrey

Community Leader
PaulD
Posts: 1,214
Registered: 09-02-2008
0

Re: How to get one character at a time from a string?

This appears to be a bug in iTest.  [string index ...]  should be supported, but appears to be missing.

 

As a workaround, you can use [string range str lower upper].  For example, [string range "abc" 1 1] will return "b".

Contributor
maiphan
Posts: 66
Registered: 09-11-2008
0

Re: How to get one character at a time from a string?

iTest is not supporting string split right now. Are you going to add that in?

 

Thanks.

Community Leader
PaulD
Posts: 1,214
Registered: 09-02-2008
0

Re: How to get one character at a time from a string?

Our goal is to support all relevant standard Tcl commands (and subcommands) wherever possible.  In some cases, we are still filling in the gaps.  Thanks for bringing this one to our attention.
Expert
KumarS
Posts: 2,233
Registered: 08-30-2008
0

Re: How to get one character at a time from a string?

iTest 3.4 supports almost all of string commands and many more standard tcl commands.
Contributor
jefflee
Posts: 11
Registered: 10-10-2008
0

Re: How to get one character at a time from a string?

Thanks. This works.