mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 14:01:31 -06:00
1891ea7966
* Remove All Trailing Whitespace Characters in '.ps1' Files * Remove All Trailing Whitespace Characters in '.json' Files * Remove All Trailing Whitespace Characters in '.yaml' Files * Remove All Trailing Whitespace Characters in Different Files * Remove Even More Trailing Whitespace Characters
27 lines
891 B
PowerShell
27 lines
891 B
PowerShell
function Get-WPFObjectName {
|
|
<#
|
|
.SYNOPSIS
|
|
This is a helper function that generates an objectname with the prefix WPF that can be used as a Powershell Variable after compilation.
|
|
To achieve this, all characters that are not a-z, A-Z or 0-9 are simply removed from the name.
|
|
.PARAMETER type
|
|
The type of object for which the name should be generated. (e.g. Label, Button, CheckBox...)
|
|
.PARAMETER name
|
|
The name or description to be used for the object. (invalid characters are removed)
|
|
.OUTPUTS
|
|
A string that can be used as a object/variable name in powershell.
|
|
For example: WPFLabelMicrosoftTools
|
|
|
|
.EXAMPLE
|
|
Get-WPFObjectName -type Label -name "Microsoft Tools"
|
|
#>
|
|
|
|
param( [Parameter(Mandatory=$true)]
|
|
$type,
|
|
$name
|
|
)
|
|
|
|
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', ''
|
|
|
|
return $Output
|
|
|
|
} |