jvanegmond Posted March 3, 2006 Posted March 3, 2006 I need to remove a number from a string. As in: 123456 - 2 = 13456 Only when i try to do it 123456 - 2 = 123452 comes out Which ofcourse is, a simple math function, which i don't want.. Well, i hope you understand ; example code $array = 123456789 For $x = 1 to 9 $array = $array - $x Next MsgBox(0, "", $array) ;this would pop a empty message box. github.com/jvanegmond
Moderators big_daddy Posted March 3, 2006 Moderators Posted March 3, 2006 (edited) $a = 123456 $a = StringReplace($a, "2", "") Edited March 3, 2006 by big_daddy
jvanegmond Posted March 3, 2006 Author Posted March 3, 2006 Thanks for the fast reply! Dang, that's clever ( or i'm plain dumb ) github.com/jvanegmond
freanir Posted March 3, 2006 Posted March 3, 2006 (edited) Use StringReplace(). Example: $sString = 123456789 $sString = String($sString);Because 123456789 is a integer $iNumber = 2 $sStrippedString =StringReplace($sString, String($iNumber), "") MsgBox(0, "Result", $sStrippedString) EDIT: Next time I have to be quicker. Edited March 3, 2006 by freanir freanir
Developers Jos Posted March 3, 2006 Developers Posted March 3, 2006 123456 - 2 = 123452 comes out Which ofcourse is, a simple math function.. mmmm are you sure ? sounds wrong to me .... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GaryFrost Posted March 3, 2006 Posted March 3, 2006 mmmm are you sure ? sounds wrong to me .... Guess I need to go back to math class againI would of thought123456 - 2 = 123454 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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