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.
Powershell

Avatar of undefined
Last Comment
Bobby Llih

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
David Johnson, CD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Bobby Llih

ASKER
Many Thanks :)
Your help has saved me hundreds of hours of internet surfing.
fblack61