A1=欢迎来到优快云论坛
B1=倒置文本(A1)=坛论NDSC到来迎欢
C1=倒置(A1)=坛论优快云到来迎欢
一、倒置全部文本字符
Function 倒置文本(str As String)
倒置文本 = StrReverse(str)
End Function
B1=倒置文本(A1)=坛论NDSC到来迎欢
二、倒置汉字,英文字母和数字不倒置
Function 倒置(str As String)
Application.Volatile True
Dim i%, temp$, str1$, k%
For i = Len(str) To 1 Step -1
str1 = Mid$(str, i, 1)
If str1 Like "[a-z,A-Z,0-9]" Then
k = k + 1
temp = Left$(temp, Len(temp) - k + 1) & str1 & Right$(temp, k - 1)
Else
temp = temp & str1
End If
Next
倒置 = temp
End Function
C1=倒置(A1)=坛论优快云到来迎欢