Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

ASP.NET: Reverse a string

From Wiki

Jump to: navigation, search

Summary: Reverse a string

Here's a couple of simple methods you can use to reverse a string:

  1. Partial Class Default1
  2.     Inherits System.Web.UI.Page
  3.  
  4.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5.         Response.Write(ReverseString("olleh"))
  6.     End Sub
  7.  
  8.     Public Function ReverseString(ByVal targetString As String) As String
  9.         Dim Characters() As Char = targetString.ToCharArray
  10.         Array.Reverse(Characters)
  11.         Return Characters
  12.     End Function
  13.  
  14.     Private Function ReverseString2(ByVal targetString As String) As String
  15.         Return StrReverse(targetString)
  16.     End Function
  17. End Class

Output:


This Hack is part of the ASP.NET Hacks collection

483 Rating: 3.0/5 (4 votes cast)