-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRemove-StringSpace.ps1
55 lines (35 loc) · 1.78 KB
/
Remove-StringSpace.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<#
.SYNOPSIS
This function removes all spaces from any user inputted string. Prevents trianing and leading spaces.
.DESCRIPTION
This function removes all spaces from any user inputted string. Prevents trianing and leading spaces.
.PARAMETER stringToFix
The string to remove all spaces from.
.OUTPUTS
Empty status file directory.
.EXAMPLE
remove-StringSpace -stringToFix STRING
#>
Function remove-StringSpace
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $false)]
[string]$stringToFix=0
)
#Output all parameters bound or unbound and their associated values.
write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore)
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN remove-StringSpace"
Out-LogFile -string "********************************************************************************"
out-logfile -string ("String to remove spaces: "+$stringToFix)
out-logfile -string ("String Length "+$stringToFix.length.toString())
$workingString = $stringToFix.trim()
out-logfile -string ("String with spaces removed: "+$workingString)
out-logfile -string ("String Length "+$workingString.length.toString())
return $workingString
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END remove-StringSpace"
Out-LogFile -string "********************************************************************************"
}