Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Bitwise Shifting for Strings
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static string bitwisestrings(string s1, int s2) { char[] s1array = s1.ToCharArray(); char[] endarray = s1array; char a = (char)5; a <<= 3; string returnstring = ""; for (int i = 0; i < endarray.Length; i++) { endarray[i] <<= s2; returnstring += endarray[i]; } return returnstring; } public static void Main(string[] args) { string st = "HELLO WORLD, THIS IS A BEAUTIFUL STRING!!!!!! abcdefghijklmnopqrstuvvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int rnd = new System.Random().Next(0, 100); Console.WriteLine("the String \"" + st + "\" bitshifted to the left by " + rnd + " is \"" + bitwisestrings(st, rnd) + "\"."); } } }
run
|
edit
|
history
|
help
0
ee
Homework1
enum.TryParse
C
Write a program to count the occurrence of each distinct item in the array?
Stuff
Test Daylight Savings
TrzyKreski
Salario
Triangulo de pascal