String


Definition: Returns a repeating character string of the length specified.

  

The String function provides a quick, reasonably fail-safe way to create a string consisting of a specified number of repeating characters. In other words, a string similar to this:

 

"===================="

 

(Yeah, we know. But this is sometimes useful when formatting data for display in a command window.)

If you ever doneed to string together 20 equal signs or what-have-you in Windows PowerShell, you can accomplish this task by multiplying (yes, we said multiplying) an equals sign by 20 (strange, but true):

 

$a = "=" * 20

 

When you run this command and then echo back the value of $ a youshould get the following:

 

====================