Language: PowerShell
Truncate a string to specified length
function truncate-string([string]$value, [int]$length) { if ($value.Length -gt $length) { $value.Substring(0, $length) } else { $value } }
Tags:
Comment:
Couldn't find a truncate string function built-in, so I created one.
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

