C# Text Flip Example - LINQ

AceInfinity

Emeritus, Contributor
Joined
Feb 21, 2012
Posts
1,728
Location
Canada
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.)

:beerchug2:
 
Last edited:

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top