seanrintel Posted May 2, 2006 Share Posted May 2, 2006 G'day, Is it possible to extract numbers from two strings (e.g. from window titles) and then compare those two numbers to find which is bigger? Something like this: $Title1 = $WinList[1][0] $Title2 = $WinList[2][0] $Number1 = Some operation to extract the number from $Title1 and make it a usable integer $Number2 = Some operation to extract the number from $Title2 and make it a usable integer If $Number1 < $Number2 Then ; Do something ElseIf $Number1 > $Number2 Then ; Do something else EndIf Any help would be greatly appreciated. Until anon, Sean Link to comment Share on other sites More sharing options...
Don N Posted May 2, 2006 Share Posted May 2, 2006 how are these string formatted, if you could paste some sample string here it'd be easier to help find a solution _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper Link to comment Share on other sites More sharing options...
seanrintel Posted May 2, 2006 Author Share Posted May 2, 2006 G'day Don,how are these string formatted, if you could paste some sample string here it'd be easier to help find a solutionThere are 24 possible window titles all in this format: "suny1", "suny2", "suny3" ... "suny24".Until anon,Sean Link to comment Share on other sites More sharing options...
Don N Posted May 2, 2006 Share Posted May 2, 2006 $str1 = "suny12" $str2 = "suny20" $int1 = StringTrimLeft( $str1, 4 ) $int2 = StringTrimLeft( $str2, 4 ) ;compare the ints and do whatever else here StringTrimLeft(), as i used it here, wioll remove the 4 leftmost characters from the string leaving only the integer part remaingin. Check out the helpfile in StringTrimLeft adn StringTrimRight for more details. hope this helps _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper Link to comment Share on other sites More sharing options...
Rauto Posted May 2, 2006 Share Posted May 2, 2006 quick and dirty but it extracts 25 from Un25titled $Num="" $winTitle="Un25titled" For $i = 1 to StringLen($winTitle) $char=StringMid($winTitle,$i,1) if ASC($char) < 58 then $Num=$Num & $char Next msgbox(0,"",$Num) Rauto Link to comment Share on other sites More sharing options...
seanrintel Posted May 3, 2006 Author Share Posted May 3, 2006 G'day all, Thanks for the suggestions. Both were helpful, Don's especially. Thanks, Sean 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