字符串反转在c#中 [英] String Reverse In c#
本文介绍了字符串反转在c#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望C#CODE for String reverse with out using for循环,while循环,do while循环,String反向函数即内置函数,请分享你有任何解决方案
谢谢
sandeep m
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
推荐答案
不使用C#和VB中的Reverse函数反转字符串 [ ^ ]
反向字符串而不使用VB和C#中的反转功能 [< a href =http://www.codeproject.com/Tips/230062/Reverse-of-a-String-without-using-Function-in-shatarget =_ blanktitle =New Window> ]
用于反转字符串和StringBuilder对象的扩展方法 [ ^ ]
如何在不使用C#内置函数的情况下反转字符串句子(仅限单词)[ ^ ]
C#中的各种字符串反转算法 [< a href =http://www.codeproject.com/Articles/79439/Various-string-reversal-algorithms-in-Ctarget =_ blanktitle =New Window> ^ ]
希望它有所帮助。
Reverse of a string without using the Reverse function in C# and VB[^]
Reverse of a string without using the Reverse function in VB and C#[]
Extension Methods to Reverse a String and StringBuilder Object[^]
How to reverse a string sentence (only words) without using the C# built-in functions[^]
Various string reversal algorithms in C#[^]
hope it helped.
您可以使用数组来执行此操作 -
You can use an Array to do this -
char[] arr = myStr.ToCharArray();
11.Array.Reverse(arr );
12.return new string(arr );
但是,您正在使用Array reverse in这种情况。
You are however, using Array reverse in this case.
你知道C#
提供(in)着名的goto
:
You knowC#
provides the (in)famousgoto
:
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;
}
这篇关于字符串反转在c#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文