Click here to Skip to main content
13,295,243 members (68,780 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 21 Jul 2011

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

, 26 Jul 2011
Rate this:
Please Sign up or sign in to vote.
How to reverse a string without using the Reverse function in C# and VB.

This is a simple code snippet for reversing a string without using the Reverse function. For example, we have a string "KUMAR"; without using a function, we can reverse it using the code snippet below. Code is given in both C# and VBalso. This will be helpful to beginners. If you have any queries, please feel free to ask me.

class ReverseString
    public static void Main(string[] args)
        string Name = "He is palying in a ground.";
        char[] characters = Name.ToCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = Name.Length - 1; i >= 0; --i)


Class ReverseString
    Public Shared Sub Main(args As String())
        Dim Name As String = "He is palying in a ground."
        Dim characters As Char() = Name.ToCharArray()
        Dim sb As New StringBuilder()
        For i As Integer = Name.Length - 1 To 0 Step -1
    End Sub
End Class


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


About the Author

Software Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
Sergey Alexandrovich Kryukov6-Jul-14 21:56
mvpSergey Alexandrovich Kryukov6-Jul-14 21:56 
GeneralMy vote of 1 Pin
Member 1058994326-Jun-14 22:48
memberMember 1058994326-Jun-14 22:48 
Generalwhats the point of this ? Pin
Xmen W.K.27-Jul-11 1:10
memberXmen W.K.27-Jul-11 1:10 
GeneralReason for my vote of 1 What is the utility of this? Pin
Jaime Olivares25-Jul-11 17:35
memberJaime Olivares25-Jul-11 17:35 
GeneralReason for my vote of 1 Globally known age old problem since... Pin
Prerak Patel23-Jul-11 0:45
mvpPrerak Patel23-Jul-11 0:45 
General[edit] removed email address. Pin
Indivara22-Jul-11 13:14
subeditorIndivara22-Jul-11 13:14 
GeneralFew notes Pin
Mika Wendelius22-Jul-11 1:55
memberMika Wendelius22-Jul-11 1:55 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171207.1 | Last Updated 26 Jul 2011
Article Copyright 2011 by hemantwithu
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid