我是VBA nwebie。我想在两个斜线之间剪切String。这是我的字符串
/branches/test
我希望获得以下输出
branches
我该如何定义它?
答案 0 :(得分:1)
您可以按Split
功能继续;
Dim s as string = "/branches/test"
Dim sArray() As String
Dim result As String
sArray = Split(s, "/")
result = sArray(1)
答案 1 :(得分:0)
这正是我需要的
Dim x As Variant
Dim i As Long
x = Split("/branches/test", "/")
For i = 1 To UBound(x)
Debug.Print x(i)
Next i
输出是
branches
test