AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Reversing a String

This tip demonstrates how to reverse the position of the characters in a string.  For example, the string "String" will be converted to "gnirtS".

Function Code

Public Function reversestring(revstr As String) As String
' revstr: String to reverse
' Returns: The reverse string

Dim doreverse As Long

reversestring = ""
For doreverse = Len(revstr) To 1 Step -1
reversestring = reversestring & Mid$(revstr, doreverse, 1)
Next

End Function

Use

Dim strResult As String
strResult = reversestring("String")
MsgBox strResult

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/