Jack_10 Posted August 26, 2006 Share Posted August 26, 2006 hey ! How can i change number format (standard is without decimal point if numer is integer type) example : Dim $x $x = 2.3333 $x = Int($x) MsgBox(0, "x", "$x = " & $x) ; x = 2 , but i wanna x = 2.0000 Dim $x $x = 2.0 $x = Int($x) MsgBox(0, "x", "$x = " & $x) ; x = 2 , but i wanna x = 2.0 I need in my program function IsInt to round() down numbers , but also need *.000 after integer number Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2006 Moderators Share Posted August 26, 2006 Dim $x $iZeros = 4 $x = 2.3333 $x = Int($x) MsgBox(0, "x", "$x = " & StringFormat('%.' & $iZeros & 'f', $x)); x = 2 , but i wanna x = 2.0000 Dim $x $iZeros = 1 $x = 2.0 $x = Int($x) MsgBox(0, "x", "$x = " & StringFormat('%.' & $iZeros & 'f', $x)); x = 2 , but i wanna x = 2.0 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Jack_10 Posted August 26, 2006 Author Share Posted August 26, 2006 thx SmOke_N !!! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2006 Moderators Share Posted August 26, 2006 (edited) Your welcome, a suggestion I might make is if you are going to use this in various places, rather than typing it out over and over since it involves some text is to just make it into a simple function:Dim $x $x = 2.0 $x = Int($x) MsgBox(0, "x", "$x = " & _Convert(4, $x)) Func _Convert($iNum, $vVar) Return StringFormat('%.' & $iNum & 'f', $vVar) EndFuncoÝ÷ ÛÞx-éî·«¡üÞ®Á©íiû^®Ø^uç"©ZÝ7ë¾*.²z)දj²0j{m¡Ú"·Gb´êâ*.ßÚÞjÊÈ(x-¢f¤z+Z)íz«~*쵫¢+Ù¥´ÀÌØíà(ÀÌØíàôȸÀ)5Í ½à À°ÅÕ½ÐíàÅÕ½Ðì°ÅÕ½ÐìÀÌØíàôÅÕ½ÐìµÀì} ½¹ÙÉРаÀÌØíत()Õ¹} ½¹ÙÉÐ ÀÌØí¥9Õ´°ÀÌØíÙYȤ(%IÑÕɸMÑÉ¥¹½ÉµÐ Ìäì¸ÌäìµÀìÀÌØí¥9Õ´µÀìÌäíÌäì°%¹Ð ÀÌØíÙYȤ¤)¹Õ¹ Edited August 26, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Jack_10 Posted August 26, 2006 Author Share Posted August 26, 2006 (edited) great ! btw what is difrence between ( ' ) and ( " ) i have used both of them in code and both work !!! 1st MsgBox(0, "x", "$x = " & StringFormat('%.' & $iZeros & 'f', $x)) 2nd MsgBox(0, "x", "$x = " & StringFormat("%." & $iZeros & "f", $x)) Edited August 26, 2006 by Jack_10 Link to comment Share on other sites More sharing options...
Valuater Posted August 26, 2006 Share Posted August 26, 2006 (edited) you can create lines with the " in it using '"'... example MsgBox(64, "Test", 'This word has "quotes"') 8) Edited August 26, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 26, 2006 Moderators Share Posted August 26, 2006 I'm just too lazy... It's 1 less key stroke to use a single quote vs. a double ... But as far as syntax, nothing is different until you need to add quotes within quotes for strings. (as I think Valuater was trying to demonstrate but looks like the code tags ate it). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted August 26, 2006 Share Posted August 26, 2006 yea... your right... the code tags did will fix now 8) Link to comment Share on other sites More sharing options...
Jack_10 Posted August 26, 2006 Author Share Posted August 26, 2006 cool thx all u guys Link to comment Share on other sites More sharing options...
Jack_10 Posted August 26, 2006 Author Share Posted August 26, 2006 is there any difrence when i write my own function Func xxx() ....... EndFunc at the begginig of the script or at the end of script ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now