Jump to content

Recommended Posts

Posted

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

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
  • Recently Browsing   0 members

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