This is a migrated thread and some comments may be shown as answers.

Code to split a string and run in coded step

4 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abdul Khader
Top achievements
Rank 1
Abdul Khader asked on 23 Feb 2016, 02:44 PM

Hi Team,

 

Any advice on below issue :

 

Requirement : In Coded Step, I want to write a code such that string should split into two halves based on delimiter and save it in two diff variables

Any Code/Functionality available in Telerik Test Studio to achieve this ?

  

Please find the snapshot for example

 

Regards

Abdul

 

4 Answers, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 24 Feb 2016, 09:21 AM
Hello Abdul,

Is this number always contains 6 digits at the end? If yes you can use the following code:

string code = "For DEMO purposes the current Mobile Phone code is: 085208";
string newcode = code.Substring(code.Length - 6);
Log.WriteLine(newcode);

Please note that extracting from string is a general programming problem not related to Test Studio at all. Next time when you have a similar task you can look in MSDN or any other public resource on how to achieve it.

Thank you for your understanding.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Abdul Khader
Top achievements
Rank 1
answered on 24 Feb 2016, 04:28 PM

Thanks Ivaylo for quick reply.

 

The other way I achieved this is with 'Split' function. However thanks for the code snippet.

 

Also I have one other query for you

 

Scenario is such that I need to select a value "V1" in Drop-down list "D1" and select value "V2" in Drop-down list "D2"

Both the drop-downs are on same page and they have got same properties and list item values.(Image Attachment Included)

 

In such cases, how can I select different item values of different drop downs on same page ?

 

 

 

0
Abdul Khader
Top achievements
Rank 1
answered on 24 Feb 2016, 04:32 PM

FYI .... I am new to Telerik Test Studio and C# language

 

I am aware of 'Index' concept in general because I worked on QTP(UFT) and selenium

How can we achieve same thing in Telerik Test or C# ? Please Advise

 

Thanks

Abdul

0
Ivaylo
Telerik team
answered on 26 Feb 2016, 05:06 AM
Hello Abdul,

You can use Test Studio recording function. Test Studio will record those steps automatically for you.

Since you are new to Test Studio I suggest you to take a look at our documentation. Refer to the Getting Started section.

Regards,
Ivaylo
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Abdul Khader
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Abdul Khader
Top achievements
Rank 1
Share this question
or