Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop Non-numeric strings from crashing the server.
#21
I was just thinking, if you want to be truely protected with these conversions, you'll also need to check for overflows.
[code]Private Function CCByte(ByRef s As String) As Byte
' Make sure there is a valid string
If LenB(s) = 0 Then Exit Function
' Check if it's a number
If Not s Like "*[!0-9]*" Then
' Check for overflows
If s >= 0 Then
If s = -32768 Then
If s = -2147483468 Then
If s
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)