我有这个字符串:
Dim stringToCleanUp As String = "bon;jour"
Dim characterToRemove As String = ";"
Run Code Online (Sandbox Code Playgroud)
我想要一个删除';'的函数 像这样的人物:
Function RemoveCharacter(ByVal stringToCleanUp, ByVal characterToRemove)
...
End Function
Run Code Online (Sandbox Code Playgroud)
功能是什么?
回答:
Dim cleanString As String = Replace(stringToCleanUp, characterToRemove, "")
Run Code Online (Sandbox Code Playgroud)
十分感谢!
我想要抑制可能出现在我的VBS登录脚本中的所有错误.
我可以用以下内容包围WHOLE 500行脚本:
On Error Resume Next
'[... whole script (~500 lines of code) ...]
On Error GoTo 0
Run Code Online (Sandbox Code Playgroud) 我创建一个像这样的数组:
$Array = @()
$Item = New-Object PSObject
$Item | Add-Member -Type NoteProperty -Name item1 -Value test
$Item | Add-Member -Type NoteProperty -Name item2 -Value test
$Array += $Item
Run Code Online (Sandbox Code Playgroud)
现在我想$Item在添加之前添加一个检查以确定是否为空$Array。我怎样才能得到 的会员数量$Item?
我尝试过类似的东西:
$Item.count
$Item.length
@($Item).count
($Item | Measure).count
($Item | Get-Member).count
$Item.psobject.members.count
Run Code Online (Sandbox Code Playgroud)
但他们都没有给我实际的会员人数。