cparadis 0 Report post Posted May 27, 2009 I don't know what i doing wrong. I want to check if 127.0.0.1 is numbers. And i removed port and the dot's, but it fails $ip = "127.0.0.1:1234" ;Remove the port $var = stringsplit($ip, chr(58)) ;Replace . with nothing. $var = stringreplace($var[1],chr(46),"") ;If variable is number, msgbox.. if IsNumber($var) == 1 then msgbox(0, "", $var) else msgbox(0, "", "failed") EndIf Share this post Link to post Share on other sites
oMBRa 1 Report post Posted May 27, 2009 it fails because ''$var'' it's a string, no matter if they are number it is treated as string, you have to convert it to number first $ip = "127.0.0.1:1234" ;Remove the port $var = stringsplit($ip, chr(58)) ;Replace . with nothing. $var = stringreplace($var[1],chr(46),"") ;If variable is number, msgbox.. if IsNumber(Number($var)) == 1 then msgbox(0, "", $var) else msgbox(0, "", "failed") EndIf Share this post Link to post Share on other sites
Melba23 2,629 Report post Posted May 27, 2009 cparadis,$var is a string - you need to convert it to a number first.$var = Number(stringreplace($var[1],chr(46),""))orIsNumber(Number($var))M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
cparadis 0 Report post Posted May 27, 2009 (edited) Haha, that was the problem. Thanks for the help Edit: Fixed it, thankls for the help Edited May 27, 2009 by cparadis Share this post Link to post Share on other sites