Adventures in Powershell. These posts have been created as a record of the successful powershell commands I have used.
Monday, May 16, 2016
Text manipulation
Replace, Remove
A simple character removal from a string
$SapSName = "El-Asswi"
If ($SapSName -like "*-*")
{
$SapSName = $SAPSName.Replace("-","")
}
$SapSName
The following manipulates this $DeploymentTypeRef
<DeploymentTypeReference AuthoringScopeId="ScopeId_AA0BA009-8B99-4F9F-A54D-4E5F3F43F0FA" LogicalName="DeploymentType_a1c9acc4-a0fa-4f79-b0a0-b0da75418f9d" Changeable="true" />
into this $DeploymentTypeRefExtract
ScopeId_AA0BA009-8B99-4F9F-A54D-4E5F3F43F0FA/DeploymentType_3d3239d1-e3dd-4be0-bcbf-cde7e0a84c7f
$DeploymentTypeRefExtract = $DeploymentTypeRef.Remove(0,61).Replace(""" LogicalName=","").Replace("""DeploymentType","/DeploymentType").Replace(""" Changeable=","").Replace("true"" />","").Replace("""","")