Link to home
Start Free TrialLog in
Avatar of Bobby Llih
Bobby Llih

asked on

PowerShell - Remove Last Comma From Output

Can someone help, this function will convert strings of text to uppercase and add, "0x##," every two spaces.
However, there is an un-needed comma at the end. How do I remove end comma?
Function Convert_To_Hex ($Hex_01)
  $Hex = $Hex_01.ToUpper() -Replace '(..)', '0x$1, '
  Write-Host $Hex

Convert_To_Hex 87ceeb

# Output: 0x87, 0xCE, 0xEB,

Open in new window

Thanks In Advanced.
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bobby Llih
Bobby Llih


Many Thanks :)