Click here to Skip to main content
12,622,032 members (33,580 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I want C# CODE for String reverse with out using for loop , while loop , do while loop, and String reverse Functions ie inbuilt functions also ,Please share u have any solution
thanks
sandeep m
Posted 15-Jan-13 22:45pm
Updated 16-Jan-13 4:57am
v2
Comments
Sandeep Mewara 16-Jan-13 10:23am
   
It does not work like this here.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You can use an Array to do this -
char[] arr = myStr.ToCharArray();
11.Array.Reverse(arr );
12.return new string(arr );

You are however, using Array reverse in this case.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

You know C# provides the (in)famous goto:
public static string reverse(string s)
{
  string r = string.Empty;
  int i= s.Length-1;
  L1:
  if (i<0) return r;
  r = r + s[i];
  i--;
  goto L1;
}
  Permalink  
Comments
s_mon 16-Jan-13 5:01am
   
You're having a lot of fun, don't you :)
Marcus Kramer 16-Jan-13 9:59am
   
I'd like to see what his instructor says when he hands this one in.
Normally I would chastise you for giving code to a blatant homework question, but in this case it would be the OP's own fault if he handed this in.
CPallini 16-Jan-13 10:11am
   
Well, is is a legal solution to OP's problem.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100