'///移位算法
Public Function MoveChar(SData As String, IsbeforeDirection As Boolean, Movestep As Integer)
If IsbeforeDirection Then '前移Movestep步
For i = 1 To Movestep
SData = Right(SData, Len(SData) - 1) & Left(SData, 1)
Next i
Else '后移Movestep步
For i = 1 To Movestep
SData = Right(SData, 1) & Left(SData, Len(SData) - 1)
Next i
End If
MoveChar = SData
End Function
' MsgBox MoveChar("123456", True, 3) --->456123
' MsgBox MoveChar("happy new year", True, 3) --->py new yearhap
Public Function MoveChar(SData As String, IsbeforeDirection As Boolean, Movestep As Integer)
If IsbeforeDirection Then '前移Movestep步
For i = 1 To Movestep
SData = Right(SData, Len(SData) - 1) & Left(SData, 1)
Next i
Else '后移Movestep步
For i = 1 To Movestep
SData = Right(SData, 1) & Left(SData, Len(SData) - 1)
Next i
End If
MoveChar = SData
End Function
' MsgBox MoveChar("123456", True, 3) --->456123
' MsgBox MoveChar("happy new year", True, 3) --->py new yearhap
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货