{"id":177,"date":"2014-08-30T15:03:23","date_gmt":"2014-08-30T19:03:23","guid":{"rendered":"http:\/\/blog.metcorp.org\/?p=177"},"modified":"2014-08-30T15:03:23","modified_gmt":"2014-08-30T19:03:23","slug":"powershell-drop-remove-the-last-character-from-a-string","status":"publish","type":"post","link":"https:\/\/adsecurity.org\/?p=177","title":{"rendered":"PowerShell: Drop (remove) the last character from a string"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\">Drop (remove) the last character from a string:<\/span><\/p>\n<p>$ComputerName = \u2018DCCOMP01$\u2019<br \/>\n$ComputerName = $ComputerName.Substring(0,$ComputerName.Length-1)<br \/>\n$ComputerName<\/p>\n<p>Result is \u201cDCCOMP01\u2033.<br \/>\nThis works especially well when the last character is a special PowerShell reserved one like \u201c$\u201d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Drop (remove) the last character from a string: $ComputerName = \u2018DCCOMP01$\u2019 $ComputerName = $ComputerName.Substring(0,$ComputerName.Length-1) $ComputerName Result is \u201cDCCOMP01\u2033. This works especially well when the last character is a special PowerShell reserved one like \u201c$\u201d.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,2],"tags":[62,63],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-powershell","category-technical-reference","tag-favorite","tag-powershell-code-snippet","item-wrap"],"_links":{"self":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177"}],"version-history":[{"count":1,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":178,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/177\/revisions\/178"}],"wp:attachment":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}