当前位置:编程学习 > VB >>

翻转一个字符串

 

下面的函数利用递归原理获得字符串的翻转字符串

Function reversestring(revstr As String) As String

revstr: 要翻转的字符串

返回值:翻转后的字符串

 

Dim doreverse As Long

 

reversestring = ""

For doreverse = Len(revstr) To 1 Step -1

reversestring = reversestring & Mid$(revstr, doreverse, 1)

Next

 

End Function

 

补充:软件开发 , Vb ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,