Jump to content

123456 - 2 = 13456 ?


Recommended Posts

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Developers

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

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...