How to "subtract strings"?

Posted on 2007-10-06
Last Modified: 2012-05-05
The mathematical operators are easy to use and everybody knows:


$a + $b = 11
$a - $b = 9

However, if variables are strings rather than numbers, sometimes is confusing...


$a & $b (the correct; not $a + $b because no numbers!) = "AAAAAAAZZZZZZZZZZZZZZZAAAAAAAZZZZZZZZZZZZZZZ"

My question is - How to subtract characters using string variables?:

«$a - $b» = "AAAAAAA" (what is the correct expression, instead of «$a - $b»?)

Question by:asgarcymed
    LVL 92

    Accepted Solution

    MsgBox Replace(a, b, "")

    Author Comment

    Works fine; thank you!
    Best regards.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    A short article about problems I had with the new location API and permissions in Marshmallow
    This is about my first experience with programming Arduino.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now