Click here to Skip to main content
Click here to Skip to main content

Tagged as

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

, 26 Jul 2011 CPOL
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

Comments and Discussions

GeneralMy vote of 1 PinmvpSergey Alexandrovich Kryukov6-Jul-14 21:56 
GeneralMy vote of 1 PinmemberMember 1058994326-Jun-14 22:48 
Generalwhats the point of this ? PinmemberXmen W.K.27-Jul-11 1:10 
GeneralReason for my vote of 1 What is the utility of this? PinmemberJaime Olivares25-Jul-11 17:35 
GeneralReason for my vote of 1 Globally known age old problem since... PinmvpPrerak Patel23-Jul-11 0:45 
General[edit] removed email address. PinsubeditorIndivara22-Jul-11 13:14 
GeneralFew notes PinmemberMika Wendelius22-Jul-11 1:55 

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

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

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