Progress Monitor for IdealProgrammer.com
Take Swift, Intelligent, Massive, Planned, Loving, Effective (S.I.M.P.L.E.) Action to Transform Self into Ideal
Skip Repetitive Navigational Links
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console
Please login
C-Sharp StrReverse Example Syntax - C# String Function - Sample Code
Description:
Illustrates the C# Syntax for StrReverse.
Example Class Main:
using System; public class clsStrReverse { public void Main() { //**************************************************************************************** // There is not an exact equivalent of vb.net strReverse in C# so we simulate it // Example #1: StrReverse(string) - returns a string with the characters of the // string in reverse order //**************************************************************************************** Console.WriteLine("Example #1: StrReverse(string) "); string strString1 = "Hello World"; // Return Uppercase Console.WriteLine(SimulateStrReverse.StrReverse(strString1)); //Returns dlroW olleH //write blank line to make output easier to read Console.WriteLine(); //Prevent console from closing before you press enter Console.ReadLine(); } } //---------------------------------------------------------------------------------------- // Copyright © 2003 - 2011 Tangible Software Solutions Inc. // This class can be used by anyone provided that the copyright notice remains intact. // // This class simulates the behavior of the classic VB 'StrReverse' function. //---------------------------------------------------------------------------------------- public static class SimulateStrReverse { public static string StrReverse(string expression) { if (expression == null || expression.Length == 0) return string.Empty; string reversedString = string.Empty; for (int charIndex = expression.Length - 1; charIndex >= 0; charIndex--) { reversedString += expression[charIndex]; } return reversedString; } }
Example Class Program:
using System; using System.Collections.Generic; using System.Linq; using System.Text; nameStrReverse CSharp_Syntax { class Program { static void Main(string[] args) { clsStrReverse myStrReverse = new clsStrReverse(); myStrReverse.Main(); } } }
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console