VB.net 字符串 分割 及 重新倒序组装

时间:2023-12-27 14:25:19
    ''' <summary>
''' split with ">>>>" , and inverted order
''' </summary>
''' <param name="groupNamePath"> 123>>>>abc>>>>456 </param>
''' <returns> 456 > abc > 123 </returns>
''' <remarks></remarks>
Protected Function transGroupNamePath(ByVal groupNamePath As String) As String
Dim strResult As String = ""
Dim strArray As String() = Regex.Split(groupNamePath, ">>>>") For i As Integer = strArray.Length - To Step -
If Not strArray(i) = "" Then
If strResult = "" Then
strResult = strResult & strArray(i)
Else
strResult = strResult & " > " & strArray(i)
End If
End If
Next
transGroupNamePath = strResult
End Function