Sign in to follow this  
Followers 0
jvanegmond

123456 - 2 = 13456 ?

7 posts in this topic

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 :o 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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$a = 123456
$a = StringReplace($a, "2", "")

Edited by big_daddy

Share this post


Link to post
Share on other sites

#4 ·  Posted (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. :o

Edited by freanir

freanir

Share this post


Link to post
Share on other sites

123456 - 2 = 123452 comes out :o Which ofcourse is, a simple math function..

mmmm are you sure ? sounds wrong to me .... :geek:

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

mmmm are you sure ? sounds wrong to me .... :o

Guess I need to go back to math class again

I would of thought

123456 - 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.

 

Share this post


Link to post
Share on other sites

( or i'm plain dumb ) :o

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0