Transform Element Using 16 Values of Matrix with CSS3

George John
Updated on 22-Jun-2020 14:57:42

242 Views

Use the matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n) method to transform the element using 16 values of matrix.Let us see the syntaxmatrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4)Here, a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 d4 are numbers showing the linear transformationa4 b4 c4 are numbers describing the translation to apply.

Manipulate Decimals with Numeric Operators in C#

Samual Sam
Updated on 22-Jun-2020 14:56:09

257 Views

With C#, you can manipulate decimals with operators such as _+, - *, etc.Let us see how to subtract decimal values.Firstly, set two decimal values −decimal d1 = 9.5M; decimal d2 = 4.2M;Now to subtract the two values −d1 = d1 - d2;The following is the code −Example Live Demousing System; using System.Linq; class Demo {    static void Main() {       decimal d1 = 9.5M;       decimal d2 = 4.2M;       d1 = d1 + d2;       Console.WriteLine("Addition of Decimals: "+d1);       d1 = d1 - d2;       Console.WriteLine("Subtraction of Decimals: "+d1);    } }OutputAddition of Decimals: 13.7 Subtraction of Decimals: 9.5

C# Program to Display Temporary File Names

karthikeya Boyini
Updated on 22-Jun-2020 14:55:40

258 Views

The GetTempPath() method in C# displays temporary file names −Path.GetTempPath();Get the names in a variable and display −string tempFile = Path.GetTempPath();The following is the code −Example Live Demousing System; using System.IO; class Demo {    static void Main() {       string tempFile = Path.GetTempPath();       Console.WriteLine(tempFile);    } }Output/tmp/

Randomize String in C#

Arjun Thakur
Updated on 22-Jun-2020 14:54:50

2K+ Views

To randomize string, firstly use Random class −Random r = new Random();Now, use the Next() method with OrderBy() −string random = new string(str.ToCharArray().OrderBy(s => (r.Next(2) % 2) == 0).ToArray());Here is the compete code that displays randomize string −Example Live Demousing System; using System.IO; using System.Linq; class Demo {    static void Main() {       const string str = "electronics";       Random r = new Random();       string random = new string(str.ToCharArray().OrderBy(s => (r.Next(2) % 2) == 0).ToArray());       Console.WriteLine("String = {0}", str);       Console.WriteLine("Random String = {0}",random);       Console.Read();    } }OutputString = electronics Random String = lericsecton

C# Program to Generate Random Lowercase Letter

Ankith Reddy
Updated on 22-Jun-2020 14:54:23

2K+ Views

Firstly, set Random class −Random random = new Random();Set a range under the Next() method. This displays a letter between 0 and 26.int a = random.Next(0, 26);Here is the complete code −Example Live Demousing System; using System.IO; using System.Linq; class Demo {    static void Main() {       Random random = new Random();       // random lowercase letter       int a = random.Next(0, 26);       char ch = (char)('a' + a);       Console.WriteLine(ch);    } }Outputt

C# Program to Match All the Digits in a String

George John
Updated on 22-Jun-2020 14:53:57

416 Views

To match all digits in a string, use C# Regex.Firstly, set a string with digits −string str = "These are my marks: 90 out of 100!";Use the following regular expression to get digits in a string −@"\d+"The following is the code −Example Live Demousing System; using System.Text.RegularExpressions; namespace Demo {    class Program {       private static void showMatch(string text, string expr) {          Console.WriteLine("The Expression: " + expr);          MatchCollection mc = Regex.Matches(text, expr);          foreach (Match m in mc) {             Console.WriteLine(m);   ... Read More

Style Every Checked Input Element with CSS

Giri Raju
Updated on 22-Jun-2020 14:53:19

218 Views

To style every checked element, use the CSS :checked selector. You can try to run the following code to implement the :checked selector −ExampleLive Demo                    input:checked {             height: 20px;             width: 20px;          }                     Fav sports:                Football          Cricket           Tennis          Tennis           Output

C# Program to Remove the End Part of a String

Chandu yadav
Updated on 22-Jun-2020 14:53:18

597 Views

Use the Regex.Replace method to remove the end part of a string in C#.The following is the string −string s1 = "Demo Text!";Now, let us say you need to remove the exclamation mark (!) from the string. For that just set it to empty using replace −System.Text.RegularExpressions.Regex.Replace(s1, "!", "");Here is the complete code −Example Live Demousing System; using System.Text.RegularExpressions; namespace Demo {    class Program {       static void Main(string[] args) {          string s1 = "Demo Text!";          // replace the end part          string s2 = System.Text.RegularExpressions.Regex.Replace(s1, "!", ... Read More

Replace Parts of a String with Regex in C#

Arjun Thakur
Updated on 22-Jun-2020 14:52:47

2K+ Views

Set a string −string str = "Bit and Bat";Let’s say you need to replace whatever comes inside B and t to A and capitalize the complete string. For that, use Replace −Regex.Replace(str, "B.t", "BAT");Let us see the complete code −Example Live Demousing System; using System.Text.RegularExpressions; namespace Demo {    class Program {       static void Main(string[] args) {          string str = "Bit and Bat";          Console.WriteLine(str);          string res = Regex.Replace(str, "B.t", "BAT");          Console.WriteLine(res);       }    } }OutputBit and Bat BAT and BAT

Check If a Character Is a Whitespace Character in C#

Samual Sam
Updated on 22-Jun-2020 14:52:19

391 Views

Set a character with WhiteSpace −char c = ' ';To check if a character is a whitespace character, use the char.IsWhiteSpace method −if (char.IsWhiteSpace(c)) {}Let us see the complete code −Example Live Demousing System; class Demo {    static void Main() {       char c = ' ';       if (char.IsWhiteSpace(c)) {          Console.WriteLine("Whitespace character!");       }    } }OutputWhitespace character!

Advertisements