external help file | Module Name | online version | schema |
---|---|---|---|
TeamsFunctions-help.xml |
TeamsFunctions |
2.0.0 |
Formats a string by removing special characters usually not allowed.
Format-StringForUse [-InputString] <String> [-Replacement <String>] [-SpecialChars <String>]
[<CommonParameters>]
Format-StringForUse [-InputString] <String> [-Replacement <String>] [-As <String>] [<CommonParameters>]
Special Characters in strings usually lead to terminating errors. This function gets around that by formating the string properly. Use is limited, but can be used for UPNs and Display Names Adheres to Microsoft recommendation of special Characters
\Test(String)"
Returns "<my>\TestString". All SpecialChars defined will be removed.
\Test(String)" -SpecialChars "\"
Returns "myTest(String)". All SpecialChars defined will be removed.
\Test(String)" -As UserPrincipalName
Returns "myTestString" for UserPrincipalName does not support any of the special characters
\Test(String)" -As DisplayName
Returns "myTest(String)" for DisplayName does not support some special characters
Format-StringForUse -InputString "1 (555) 1234-567" -As E164
Returns "+15551234567" for LineURI does not support spaces, dashes, parenthesis characters and must start with "+"
Format-StringForUse -InputString "1 (555) 1234-567" -As LineURI
Returns "tel:+15551234567" for LineURI does not support spaces, dashes, parenthesis characters and must start with "tel:+"
Mandatory. The string to be reformatted
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Optional String. Manually replaces removed characters with this string.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Desired Output Format: DisplayName, UserPrincipalName, Number, E164, LineUri. Uses predefined special characters to remove Cannot be used together with -SpecialChars
Type: String
Parameter Sets: Specific
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Default, Optional String. Manually define which special characters to remove. If not specified, only the following characters are removed: ?()[]{} Cannot be used together with -As
Type: String
Parameter Sets: Manual
Aliases:
Required: False
Position: Named
Default value: ?()[]{}
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
None
https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/Format-StringForUse.md
https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/about_Supporting_Functions.md
https://github.com/DEberhardt/TeamsFunctions/tree/main/docs/