# Thread: converting integer to string

1. ## converting integer to string

Quite a newbie here so apologies for the stupid question.
Is there a way in SilkTest to convert an INTEGER to a string?

2. ## Re: converting integer to string

</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] main()
[ ] integer i
[ ] i=10
[ ] STRING s = [STRING] i
[ ] printf(&quot;%s&quot;,s)
[ ] </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">The type casting in 4Test will work same as in other programming languages

Thanks,
Sreekanth

3. ## Re: converting integer to string

Hi,
Yes there is.
The Str() function.
Silk help is really comprehensive.
You could get most if ur answers for 4Test out there.
For the rest, the Forum is always there:-)
U a Rooney fan or does this mean something else?

4. ## Re: converting integer to string

The first reply has fixed my problem.
Thanks for your help.

5. ## Re: converting integer to string

....if anyone was interested

//
integer iRandNo
iRandNo = RandInt (0, 100000)
string pRandNo = [STRING] iRandNo
//

6. ## Re: converting integer to string

string sRandNo = "{RandInt (0, 100000)}"

John

7. ## Re: converting integer to string

Is it possible to convert string into an integer? Meaning that if I have 2004 as a string and I would like to convert this into an integer. In Silk's help it says that it converts the first character into an ASCII value.
Or is there a way to get an integer from a text box...

8. ## Re: converting integer to string

yes, it is possible to convert String into an integer.

Use function Val(&lt;String_Variable&gt

If you pass "123" it will return integer value 123
If you pass any String like "abc" it will return integer value 0
Pass "123abc" it will return integer 123
Pass "123.12" it will return integer 123

Hope this will heps you.

Thanks,
Sreekanth Varma

9. ## Re: converting integer to string

Thanks sk_varma! That was exactly what I was looking for!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:28 PM.