当前位置: 首页>>代码示例>>C#>>正文


C# String.Reverse方法代码示例

本文整理汇总了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();
 }
开发者ID:devhost,项目名称:Corelicious,代码行数:8,代码来源:StringLogicalComparerTests.cs

示例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()));
     }
 }
开发者ID:Knagis,项目名称:CommonMarkBenchmark,代码行数:11,代码来源:Program.cs

示例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();
        }
开发者ID:pazupooh,项目名称:Practice-C-,代码行数:20,代码来源:ReverseList.cs

示例4: Reverse

 public String Reverse(String Source)
 {
     return new String(Source.Reverse().ToArray());
 }
开发者ID:rykdesjardins,项目名称:pixel-lion,代码行数:4,代码来源:PixelMonkeyExample.cs

示例5: Reverse

 public String Reverse(String param)
 {
     return new String(param.Reverse().ToArray());
 }
开发者ID:modulexcite,项目名称:WcfEx,代码行数:4,代码来源:Test.cs

示例6: Transform

 public String Transform(String text)
 {
     return new string(text.Reverse().ToArray());
 }
开发者ID:mind31082015,项目名称:ExJavaTeam,代码行数:4,代码来源:CharTransformerReverse.cs

示例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++;
            }
        }
开发者ID:mgulubov,项目名称:SoftUniCourse-AdvancedCSharp,代码行数:24,代码来源:Program.cs

示例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();
 }
开发者ID:grapek9,项目名称:spojPrograms,代码行数:6,代码来源:BFN1.cs

示例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;
        }
开发者ID:pwq1989,项目名称:AddressMatch,代码行数:93,代码来源:MatchMachine.cs


注:本文中的System.String.Reverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。