Click here to Skip to main content
11,434,678 members (67,475 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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
Edited 16-Jan-13 4:57am
v2
Comments
Sandeep Mewara at 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 at 16-Jan-13 5:01am
   
You're having a lot of fun, don't you :)
Marcus Kramer at 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 at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.150428.2 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2015
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