1. #1
    AceInfinity's Avatar
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,725

    C# Text Flip Example - LINQ

    Code:
    private string TextFlip(string InputString)
    {
    	char[] X = @"/˙'\‾zʎxʍʌnʇsɹbdouɯlʞɾıɥƃɟǝpɔqɐ".ToCharArray();
    	string V = @"?\.,/_!zyxwvutsrqponmlkjihgfedcba";
    
    	return new string((from char obj in InputString.ToCharArray()
    			   select (V.IndexOf(obj) != -1) ? X[V.IndexOf(obj)] : obj).Reverse().ToArray());
    
    }
    Here's an example of a simple text flipping function I created, which will take an input and attempt to turn the text upsidedown by converting to the upsidedown equivilant char of the input, and reversing it. Nice fun LINQ example :)

    Fun challenge: Let's see if anybody here can explain to me how my function works (from the programming perspective, and not just recite what i've posted as far as a hint into how the actual function turns this text upside down.)

    Last edited by AceInfinity; 04-10-2012 at 06:42 AM.
    Automation Programmer
    Microsoft MVP [2012 - 2018]


    • Ad Bot

      advertising
      Beep.

        
       

Similar Threads

  1. [SOLVED] Showing text in a rich text box on button press - Visual C#
    By Cookieman in forum Programming
    Replies: 6
    Last Post: 12-09-2012, 03:55 PM
  2. [C#] Programming Challenge With LINQ
    By AceInfinity in forum Programming
    Replies: 0
    Last Post: 08-11-2012, 12:13 AM
  3. LINQ to MSIL Test
    By AceInfinity in forum Programming
    Replies: 0
    Last Post: 07-29-2012, 04:17 PM
  4. Replies: 0
    Last Post: 04-06-2012, 09:24 PM

Log in

Log in