Hackerszone
Welcome Guest,
learn to hack easily with tutorials, python, notepad hacks and more!
Join today, fast and free!

Are you new to hacking? Learn the basics in computer configuration, hacking tools, and hacker terminology all found here on this forum!

Join today!!

Join the forum, it's quick and easy

Hackerszone
Welcome Guest,
learn to hack easily with tutorials, python, notepad hacks and more!
Join today, fast and free!

Are you new to hacking? Learn the basics in computer configuration, hacking tools, and hacker terminology all found here on this forum!

Join today!!
Hackerszone
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 

 


Rechercher Advanced Search

HZ Tracker
Hacking Widget Visitor Details
Latest topics
»  How to study to understand and apply RPA?
[C#] String Case-Inversion EmptyTue Feb 02, 2021 7:12 am by manas41

» SQL injection and Quote escaping
[C#] String Case-Inversion EmptySun Jun 28, 2015 11:42 am by ADS1

» [TUT] Chmod: Files & Permissions [TUT]
[C#] String Case-Inversion EmptyThu Jun 04, 2015 12:45 pm by Guest

» Reaver pixiewps
[C#] String Case-Inversion EmptyThu Jun 04, 2015 12:23 pm by voidfletcher

» How To Crash Someone's Skype in 10 SECONDS
[C#] String Case-Inversion EmptyThu Jun 04, 2015 12:20 pm by voidfletcher

» Internet Security & IP Security (IPSec)
[C#] String Case-Inversion EmptyMon May 18, 2015 9:00 pm by voidfletcher

» [Python] Infinite / Definite File Generator
[C#] String Case-Inversion EmptyMon May 18, 2015 8:58 pm by ADS1

» [C#] String Case-Inversion
[C#] String Case-Inversion EmptyMon May 18, 2015 8:57 pm by ADS1

» Rekall Memory Forensic Framework
[C#] String Case-Inversion EmptySat May 16, 2015 8:55 pm by ADS1

Who is online?
In total there are 5 users online :: 0 Registered, 0 Hidden and 5 Guests

None

[ View the whole list ]


Most users ever online was 38 on Sun Mar 19, 2023 10:07 pm

[C#] String Case-Inversion

2 posters

Go down

[C#] String Case-Inversion Empty [C#] String Case-Inversion

Post by cloud9 Mon May 18, 2015 8:55 pm

"A string like this", will become, "a STRING LIKE THIS"
"A StRing LIKE this", will become, "a sTrING like THIS"
etc.

Code:
 public static class StringExtensions
    {
        public static string InvertCase(this string s)
        {
            var cArr = s.ToCharArray();


            for (var i = 0; i < cArr.Length; i++)
            {
                var cInt = (int)cArr[i];
                if ((cInt >= 65 && cInt <= 90) || (cInt >= 97 && cInt <= 122))
                {
                    cInt ^= 1 << 5;
                    cArr[i] = (char) cInt;
                }
            }


            return new string(cArr);
        }
    }
cloud9
cloud9
Moderator

Posts : 38
Join date : 2014-04-09
Age : 34

Back to top Go down

[C#] String Case-Inversion Empty Re: [C#] String Case-Inversion

Post by ADS1 Mon May 18, 2015 8:57 pm

I am not an expert in C# but here is another way to do so using lambda expressions in C#

[You must be registered and logged in to see this link.]

Code:
using System;
using System.Linq;

class StringInversion
{
    public static void Main()
    { 
        string data = "i Am A mONkeY";
       
        string invStr = new string(data.Select(chr => char.IsLetter(chr) ? (char.IsLower(chr) ? char.ToUpper(chr) : char.ToLower(chr)) : chr).ToArray());
       
        Console.WriteLine(invStr);
    }
}

ADS1
Script Kiddie
Script Kiddie

Posts : 17
Join date : 2014-05-31

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum