PowerTip: Find Other Ways to Use Split Method

PowerTip: Find Other Ways to Use Split Method

  • Comments 6
  • Likes

Summary: Find other ways to use the Windows PowerShell Split method.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find if there are other ways to use the Split method from a String object?

Hey, Scripting Guy! Answer Use the PSMethod object that returns from the method when not calling it with parenthesis,
          and then call the OverLoadDefinitions property, for example:

PS C:\> "string".split.OverloadDefinitions

string[] Split(Params char[] separator)

string[] Split(char[] separator, int count)

string[] Split(char[] separator, System.StringSplitOptions options)

string[] Split(char[] separator, int count, System.StringSplitOptions options)

string[] Split(string[] separator, System.StringSplitOptions options)

string[] Split(string[] separator, int count, System.StringSplitOptions options)

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Good. Tip

  • [Enum]::GetNames([System.StringSplitOptions])

  • This is the great tip. Thanks!

  • Thanks jv for the tip about
    <#c:#> [Enum]::GetNames([System.StringSplitOptions])
    None
    RemoveEmptyEntries
    <#c:#>
    Are these [enum] values always composed of English words?

  • That's a good one! Thank you. I guess OverLoadDefinitions does work with other Methods as well?

  • thank you