Skip to content

Split-CasingStyle

SYNOPSIS

Splits a string based on one or more casing styles.

SYNTAX

Split-CasingStyle [-Text] <String> [[-By] <String[]>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This function takes a string and an array of casing styles (via the -By parameter) and splits the string into its component words. It does this iteratively, applying each split to every token produced by the previous one.

EXAMPLES

EXAMPLE 1

Split-CasingStyle -Text 'this-is-a-kebab-case-string' -By kebab-case

this is a kebab case string

EXAMPLE 2

Split-CasingStyle -Text 'this_is_a_kebab_case_string' -By 'snake_case'

this is a kebab case string

EXAMPLE 3

Split-CasingStyle -Text 'ThisIsAPascalCaseString' -By 'PascalCase'

This Is A Pascal Case String

EXAMPLE 4

Split-CasingStyle -Text 'thisIsACamelCaseString' -By 'camelCase'

this Is A Camel Case String

EXAMPLE 5

Split-CasingStyle -Text 'this_is_a-CamelCaseString' -By kebab-case | Split-CasingStyle -By snake_case

this_is_a camelcasestring

EXAMPLE 6

'this_is_a-PascalString' | Split-CasingStyle -By 'snake_case','kebab-case','PascalCase'

PARAMETERS

-Text

The string to split

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-By

The casing style(s) to split the string by.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[string[]] - An array of strings, each representing a word in the original string

NOTES

https://psmodule.io/CasingStyle/Functions/Split-CasingStyle/