Hi all,
I am very new to this forum.
I have captured a text value into a variable, but i have to take substring. Please help me, how to take substring from that variable.
Regards,
GK
How to take Substring
Re: How to take Substring
Since Ranorex is built on .NET, you have all of the power of the .NET platform available to you. (You will have to use user-code for this, there is no way to do this with the Ranorex actions currently available.)
There are several ways to get a sub-string from a string, but it depends greatly on what you need to do. If you could provide an example of what the string is and what part you need, we may be able to help more.
There are several ways to get a sub-string from a string, but it depends greatly on what you need to do. If you could provide an example of what the string is and what part you need, we may be able to help more.
Shortcuts usually aren't...
Re: How to take Substring
Hi krstcs,
Thanks for your reply.
Actually i have stored a output value in a variable which is token no.
TokenNum=1000114247 060800
In the above example i have to pass only 060800 only as an input to a field. How to write usercode to get only 060800.
Thanks & Regards,
GK
Thanks for your reply.
Actually i have stored a output value in a variable which is token no.
TokenNum=1000114247 060800
In the above example i have to pass only 060800 only as an input to a field. How to write usercode to get only 060800.
Thanks & Regards,
GK
Re: How to take Substring
You could use string.Split() http://msdn.microsoft.com/en-us/library ... 90%29.aspx
Split, in this case, needs to know the character you are splitting the line on (' ' - a space, characters in .NET are wrapped with single-quotes). It will return an array of strings for each section of the original string that is split using the character passed in. In this case, you should have 2 sections. Since arrays in .NET (and most other languages) are 0-based indexes, the first element is 0, the second is 1, and so on. So, we want the second part of the split and use the [1] to tell .NET what index to use on the returned array.
You are a developer now, developing Ranorex .NET applications for testing, so you should learn as much as you can about .NET and software development.
Code: Select all
string newToken = TokenNum.Split(' ')[1];
You are a developer now, developing Ranorex .NET applications for testing, so you should learn as much as you can about .NET and software development.
Shortcuts usually aren't...