We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 26,295 times

Related Categories

Reverse String

kovaci

This simple code reverses a string. (ie from 'hello' to 'olleh')

Function ReverseString(ByVal sText As String) As String

Dim lenText As Long, lPos As Long
 
  If Len(sText) = 0 Then Exit Function
 
  lenText = Len(sText)
  ReverseString = Space(lenText)
 
  For lPos = lenText To 1 Step -1
    Mid$(ReverseString, lenText - lPos + 1, 1) = Mid$(sText, lPos, 1)
  Next lPos
 
End Function

Comments

  • Posted by liserdarts on 05 Apr 2002

    I think that StrReverse is not available in VB5.

  • reverse string

    Posted by postbryan on 02 Apr 2002

    agron loves coding....

    even better, use the VB intrinsic function:

    StrReverse(sText)