Moving a string with an array

Source: Internet
Author: User
Tags exit strlen
Array | String This is 2 inverse function for string processing
Features: Moving strings
With Hair: Arymoveleft ("string", the number of moves)
Cases:
Dim Strg
Strg= "123456789"
Strg=arymoveleft (strg,2)

Result: strg= "345678912"



Public Function arymoveleft (str, count)
If count = 0 Then
Arymoveleft = str
Exit Function
End If
Dim A ()
strlen = Len (str)
ReDim A (strlen)
For i = 1 to Len (str)
A (i) = Mid (str, I, 1)
Next
temp = A (1)
For i = 2 to Len (str)
A (i-1) = A (i)
Next
A (strlen) = Temp
For i = 1 to Len (str)
Result = result & A (i)
Next
Arymoveleft = Arymoveleft (result, count-1)
End Function
Public Function arymoveright (str, count)
If count = 0 Then
Arymoveright = str
Exit Function
End If
Dim A ()
strlen = Len (str)
ReDim A (strlen)
For i = 1 to Len (str)
A (i) = Mid (str, I, 1)
Next
temp = A (strlen)
For i = Len (str) to 2 Step-1
A (i) = A (i-1)
Next
A (1) = Temp
For i = 1 to Len (str)
Result = result & A (i)
Next
Arymoveright = Arymoveright (result, count-1)
End Function


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.