Difference between revisions of "Yurttas/PL/OOL/CS/F/02/06/00/String01.cs"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<syntaxhighlight lang="csharp" line start="1" enclose="div">/** * Copyright(C) 2003 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. * * ...")
 
(No difference)

Latest revision as of 07:46, 7 November 2013

 1/**
 2 *  Copyright(C) 2003
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : September 1, 2003
11 *  @author : Salih Yurttas
12 */
13
14
15using System;
16using System.Text;
17
18public class String01
19{
20
21  public static void Main(string[] args)
22  {
23    string a = "star";
24
25    Console.WriteLine("a = {0}", a);
26
27    a = ReverseIt(a);
28
29    Console.WriteLine();
30
31    Console.WriteLine("a = {0}", a);
32  }
33
34  public static string ReverseIt(string s) {
35    int l = s.Length;
36
37    StringBuilder t = new StringBuilder();
38
39    for(int i=l-1; i>=0; --i)
40      t.Append(s[i]);
41
42    return t.ToString();
43  }
44
45}