Click here to Skip to main content
15,884,836 members
Articles / Programming Languages / C# 4.0
Alternative
Tip/Trick

Reverse of a string without using the Reverse function in C# and VB

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
23 Jul 2011CPOL 12K   1
What is new in this age old method? We can use LINQ too.Dim inputString As String = "Reverse me"Dim input() As Char = inputString.ToCharArrayDim result As String = New String((From i As Integer In Enumerable.Range(1, input.Length) _ Select...

What is new in this age old method? We can use LINQ too.


VB
Dim inputString As String = "Reverse me"
Dim input() As Char = inputString.ToCharArray
Dim result As String = New String((From i As Integer In Enumerable.Range(1, input.Length) _
                                   Select input(input.Length - i)).ToArray)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
Working since 2006 on VBA, VB6, VB.Net, C#, ASP.Net, MSSQL




  • Courage is not the absence of fear, but rather the judgement that something is more important than fear.
  • The fear of suffering is worse than the suffering itself.
  • People need not fear the unknown if they are capable of achieving what they need and want.
  • Every blessing ignored becomes a curse.
  • Sometimes what's in your head isn't as crazy as you think.
  • We never really grow up, we only learn how to act in public.
  • You can make very bad teams with very good individuals.
  • Admitting mistakes means you have a sense of responsibility in your actions and that shows you are more matured than almost anyone. -Nithin


Comments and Discussions

 
Generalthough your solutions is good, however it actually calling w... Pin
ThatsAlok26-Jul-11 21:22
ThatsAlok26-Jul-11 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.