PowerTip: Get First 140 Characters from String with PowerShell

The Scripting Guys

Dr

Summary: Use Windows PowerShell to retrieve the first 140 characters from a string.

Hey, Scripting Guy! Question How can I use Windows PowerShell to retrieve the first 140 characters from a string?

Hey, Scripting Guy! Answer Use the SubString method from a string. Specify the starting point (in this case 0) and the
           number of characters to retrieve (in this case 140). The following example assumes that $a 
           contains a string with more than 140 characters:

$a.SubString(0,140)

The Scripting Guys
Dr Scripto

Follow Dr   

No Comments.