Skip to content
  • Home
  • About Me
  • Contact
Dowst.Dev
Dowst.Dev
PowerShell Weekly
Dowst.Dev
Dowst.Dev
PowerShell Weekly
  • Home
  • About Me
  • Contact
Split StringStrings

Split string into an array on line break

$string.split("`n")
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Split StringStrings

Exclude blanks when splitting a string into an array

$option = [System.StringSplitOptions]::RemoveEmptyEntries $string.split(";",$option)
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Split StringStrings

Split string into an array on semicolon

$string.split(";")
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Split StringStrings

Get all Text after a character

$string = "1. Computer name:DC-G11-FTW.contoso.com" $string.Substring($string.IndexOf(":")+1,$string.length-$string.IndexOf(":")-1)
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Split StringStrings

Get all Text before a character

$string = "[email protected]" $string.Substring(0,$string.IndexOf("@"))
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Replace StringStrings

Remove all special characters including spaces

$string = "1. Computer name:DC-G11-FTW.contoso.com" [regex]::Replace($string,"[^0-9a-zA-Z]","")
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Replace StringStrings

Remove all special characters leaving spaces

$string = "1. Computer name:DC-G11-FTW.contoso.com" [regex]::Replace($string,"[^0-9a-zA-Z ]","")
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Replace StringStrings

Replace using Regular Expression

$string = 'Thank you for calling 555-5757 your order total is $123.32' $string -Replace "[0-9]","0"
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Replace StringStrings

Replace using plain text replacement

$string = 'The quick brown fox jumps over the lazy dog' $string.Replace("brown","red")
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
Combine StringsStrings

Composite Format String

$string = 'The quick brown {0} jumps over the lazy {1}.' $string -f 'fox','dog'
Matthew DowstMar 18, 2019Mar 29, 2019
Read More
19202122


My name is Matthew Dowst and I am a father, author, blogger, Microsoft MVP in PowerShell and Azure Hybrid & Migration. And I am an enthusiast of all things PowerShell and DevOps.


Practical Automation with PowerShell
Now available on Amazon and all major book retailers

Categories

  • Active Directory
    • Groups
    • User
  • Automation
  • Azure
    • Intune
  • Collaboration
  • General
    • Array
    • Conditional Statements
    • DateTime
    • Forms/Prompts
    • Fun
    • Math
    • Tools
  • Platforms
    • SharePoint
  • PoshBytes
  • Security
    • Credentials
    • Remoting
  • Storage
    • Files
    • Folders
    • Shares
  • Strings
    • Combine Strings
    • Convert to String
    • Create String
    • Numbers
    • Regex
    • Replace String
    • Search String
    • Split String
    • String Casing
  • Systems
    • Networking
    • Performance
    • Registry
  • Uncategorized

Tags

array azure AzureAutomation conditions credential Credentials date-formats datetime dns else epoch Files Folders form friday-fun guid hardware if int ip-address join logic logs math password performance Permissions port prompt regex registry remote replace rounding search security Shares split string substring time-zones unix User webrequest wmi

Follow Me

  • About Me
  • Contact Me
  • PowerShell Weekly Archive
Copyright © 2026 - Yuki Westa Blog Theme By WP Moose