Link to home
Start Free TrialLog in
Avatar of asgarcymed
asgarcymedFlag for Portugal

asked on

How to "subtract strings"?

The mathematical operators are easy to use and everybody knows:

$a=10
$b=1

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


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


$a = "AAAAAAAZZZZZZZZZZZZZZZ"
$b = "ZZZZZZZZZZZZZZZ"

$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»?)


Regards.
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of asgarcymed

ASKER

Works fine; thank you!
Best regards.