Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Add Char to string based on number.

$
0
0

Strings have an Insert() method. Insert(2,”x”) would insert “x” at the 2nd position. You could also use the PadLeft() or PadRight() methods, which accept a desired string length and the length you’d like the string padded to. So, if you wanted a string of 10 characters, $string.PadLeft(10,’A') would insert on the left however many A’s were needed to make it 10 characters.


Viewing all articles
Browse latest Browse all 13067

Trending Articles