Jump to content

Search the Community

Showing results for tags 'putting error back in Int'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Basically, since 0 is a valid integer, I'm trying to come up with an _Integer() function that sets @error if the input is not valid. Such as a string returned from InputBox() but I'd also like it to handle numeric input. Since the new AutoIt3 release has changed Int() not to set @error I need to roll my own. Here's what I have. I'm just wondering if anyone sees a bug waiting to happen. $i = _Integer("57.7") If @error Then MsgBox(0x1010, "Test", "Int() returned error code: " & @error) Else MsgBox(0x1040, "Test", $i & " is a valid Int") EndIf Func _Integer($n) Local $legalChars = "-.0123456789" If IsString($n) Then For $x = 1 To StringLen($n) If Not StringInStr($legalChars, StringLeft($n, 1)) Then Return SetError(1, 0, 0) EndIf Next EndIf Return Int(Number($n)) EndFunc ;==>_Integer
×
×
  • Create New...