x
login about faq

PowerShell's inconsistent concatenation of strings

$a='10.1.2.' $b='3' ping $a+$b #fails with string 10.1.2.+3 $addr=$a+$b ping $addr #works

Why is the first ping string including the plus sign in the concatenation when '+' is an operator ? The presence of "ping" turns off '+' behaving as an operator because $a+$b on a line by itself returns the correct address. Is there a way to force '+' to be an operator on the ping line?

more ▼

asked Dec 24 at 02:41 PM

Gpdzone\'s gravatar image

Gary Parkinson
0

(comments are locked)
10|600 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1
x1

asked: Dec 24 at 02:41 PM

Seen: 177 times

Last Updated: Dec 24 at 02:41 PM

Related Questions

powered by AnswerHub - Enterprise Social Q&A