Convert Int To String?

Archives Forums/Win32 Discussion/Convert Int To String?

Grisu(Posted 2004) [#1]
Hi!

Any Ideas how to successfully convert INT to Str?

Old:
MyString$=Str(MyInt)

New?
MyString$=String(MyInt) 'Not working

Thanks!


Grisu(Posted 2004) [#2]
Missed a ":String" in the Function declaration that caused the error.

Better docs would help... :/


flying willy(Posted 2005) [#3]
YES. Better docs would help!


Russell(Posted 2005) [#4]
Don't INTs get type converted automatically when you do, say:
MyString$ = 300
?
EDIT: Yep, just tested it. Works fine without manual type conversion.

Russell

p.s. Yes, I think the Win32 beta is solid enough that it could be released as a release version, which would allow Mark\BRL to concentrate on the Docs, whose importance can not be overstated...


PowerPC603(Posted 2005) [#5]
I also found that you cannot just put a String to a Int, if you know that the content of the String is a number.

local MyInt:Int
local MyString:String

...

MyInt = MyString


This worked in previous Blitzes, in BMax not anymore.
Now I have to do:
MyInt = MyString.ToInt


The reverse is also possible:
MyString = MyInt.ToString



AaronK(Posted 2005) [#6]
You can also cast it.

myInt = Int(MyString)

See the Wiki

http://www.blitzwiki.org/index.php/Type_Casting

Aaron