How do I convert integer to string
Hi...I know that this is a stupid question with a simple answer, but I really can't figure out how to convert a file size (in bytes) into a string. Can anyone help me with this ?
Archive: How do I convert integer to string
How do I convert integer to string
Hi...I know that this is a stupid question with a simple answer, but I really can't figure out how to convert a file size (in bytes) into a string. Can anyone help me with this ?
The content of variable is of no explicit type. You can perform math instuctions as you like. Can you give any further informations on this?
IntOp $installerSize $size
DetailPrint "aaaaaa: $installerSize" ; works
StrCpy $installerSizeMajor $installerSize
DetailPrint "bbbbbb: $installerSizeMajor" ;works
StrCpy $installerSizeMajor $installerSizeMajor -7
DetailPrint "installerSizeMajor: $installerSizeMajor"
The last line does not show any value for $installerSizeMajor
StrCpy $0 "a string" -1 # = "a strin"
the line above is a sample from the docs
That means if the content of the variable is 2500000 than you empty the variable because you cut it by 7 positions
If you want to subtract you should use the IntOp command
I don't want to substract. Here is want I want to do:
I have $var1 = 0987654321
I want to have $var2 = 098
I thought that
StrCpy $var2 $var1 -7
will have this result. But it obviously doesn't.
How can I obtain the desired result?
Strange because in my case i used your value "0987654321" and the result was like expected = 098
Have you done exactly my example or like this ?
StrCpy $var2 "0987654321" -7
Like this it works. The problem is that i only know the value at runtime so I really NEED to use a variable instead of just entering the string.
So, again, what should I do? :)
Originally posted by Chilli24If I'm not mistaken, you should use StrCpy $var2 $var1 3. But I'm too lazy to check. ;)
I don't want to substract. Here is want I want to do:
I have $var1 = 0987654321
I want to have $var2 = 098
I thought that
StrCpy $var2 $var1 -7
will have this result. But it obviously doesn't.
How can I obtain the desired result?
Strange thing is that I tested on another script and it works...maybe the error is someplace else :( But I can't find it yet...Thanks for all your help
KenA's solution is your best bet if the number is an unknown.
-Stu