本文整理汇总了C#中System.String.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# String.Reverse方法的具体用法?C# String.Reverse怎么用?C# String.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.Reverse方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sort
private static String[] Sort(String[] input, String cultureName)
{
var culture = new CultureInfo(cultureName);
var shuffled = input.Reverse().Shuffle().ToArray();
var comparer = new StringLogicalComparer(culture);
return shuffled.OrderBy(x => x, comparer)
.ToArray();
}
示例2: BaseLine
private static void BaseLine(System.IO.TextReader reader, System.IO.TextWriter writer)
{
var x = reader.ReadToEnd();
var r = new System.Text.RegularExpressions.Regex(@"[^_a-f\s]+");
for (var k = 0; k < 3; k++)
{
var y = new String(x.Reverse().ToArray());
y = r.Replace(y, "_");
writer.Write(new string(y.Reverse().ToArray()));
}
}
示例3: Main
static void Main(string[] args)
{
String[] mr = new String[5];
mr[0] = "A";
mr[1] = "B";
mr[2] = "C";
mr[3] = "D";
mr[4] = "E";
//Output list with foreach
foreach (String s in mr)
Console.Write(s);
Console.Write("\n");
//Output list reverse with foreach
foreach (String s in mr.Reverse())
Console.Write(s);
Console.Write("\n");
Console.ReadLine();
}
示例4: Reverse
public String Reverse(String Source)
{
return new String(Source.Reverse().ToArray());
}
示例5: Reverse
public String Reverse(String param)
{
return new String(param.Reverse().ToArray());
}
示例6: Transform
public String Transform(String text)
{
return new string(text.Reverse().ToArray());
}
示例7: DoReverse
private static void DoReverse(int start, int count)
{
String[] tmp = new String[count];
int index = 0;
int fIndex = start;
for (int i = 0; i < count; i++)
{
tmp[i] = _charArray[fIndex];
index++;
fIndex++;
}
tmp = tmp.Reverse().ToArray();
index = 0;
fIndex = start;
for (int i = 0; i < count; i++)
{
_charArray[fIndex] = tmp[i];
index++;
fIndex++;
}
}
示例8: increaseValue
public String increaseValue(String value)
{
String reversedValue = string.Join("",value.Reverse());
// Console.WriteLine(value+" "+reversedValue);
return (Int32.Parse(value)+Int32.Parse(reversedValue)).ToString();
}
示例9: Match
/// <summary>
/// Backward Match
/// </summary>
/// <param name="s">address string[]</param>
/// <returns>result</returns>
public MatchResult Match(String[] s)
{
MatchHelper.Assert(s.Count() == 0,
@" input string[]'s length is 0 ");
Stack<State> MatchStack = new Stack<State>();
MatchResult result = new MatchResult();
s.Reverse();
//Store the first Match
State firstState = new State();
ReaderWriterLockSlim rwlock = _addrset.GetRWlock();
rwlock.EnterReadLock();
for (int i = 0; i < s.Count();i++)
{
State correntState = _addrset.FindNodeInHashTable(s[i]);
if (i ==0)
{
firstState = correntState;
}
if (correntState.NodeCount == 0)
{
result.ResultState = MatchResultState.NOTFOUND;
goto RESULT;
}
//MatchStack.
if (MatchStack.Count > 0)
{
FilterState(correntState, MatchStack.Peek());
if (correntState.NodeCount == 0)
{
result.ResultState = MatchResultState.NOTMATCHED;
goto RESULT;
}
}
MatchStack.Push(correntState);
}
if (MatchStack.Count == 0)
{
result.ResultState = MatchResultState.NOTFOUND;
goto RESULT;
}
if (MatchStack.Peek().NodeCount > 1)
{
result.ResultState = MatchResultState.MULTIMATCHED;
goto RESULT;
}
List<GraphNode> resList;
State TopState = MatchStack.Pop();
do
{
State nextState = MatchStack.Pop();
resList =
_addrset.ForwardSearchNode(delegate(GraphNode node)
{
return node.Name == nextState.Name;
},
TopState.NodeList);
//if (resList.Count > 1)
//{
// result.ResultState = MatchResultState.MULTIMATCHED;
// return result;
//}
} while (MatchStack.Count > 0);
rwlock.ExitReadLock();
if (resList == null || resList.Count == 0)
{
result.ResultState = MatchResultState.NOTMATCHED;
goto RESULT;
}
if (resList.Count > 1)
{
result.ResultState = MatchResultState.MULTIMATCHED;
goto RESULT;
}
result.Result = resList.First();
result.ResultState = MatchResultState.SUCCESS;
RESULT:
rwlock.ExitReadLock();
return result;
}