The Convert.ToBase64CharArray() method in C# is used to convert a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits.SyntaxFollowing is the syntax −public static int ToBase64CharArray (byte[] arr, int offsetIn, int length, char[] outArray, int offsetOut);Here, arr − An input array of 8-bit unsigned integers.offsetIn − A position within arr.length − The number of elements of arr to convert.outArray − An output array of Unicode characters.offsetOut − A position within outArray.ExampleLet us now see an example to implement the Convert.ToBase64CharArray() method −using System; public class Demo { public ... Read More
For this, you can use MySQL row_number(). Let us first create a table −mysql> create table DemoTable1342 -> ( -> Score int -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1342 values(80); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1342 values(98); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1342 values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1342 values(89); Query OK, 1 row affected (0.07 sec)Display all records from the table using select statement −mysql> select ... Read More
The Convert.FromBase64String(String) method in C# converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.SyntaxFollowing is the syntax −public static byte[] FromBase64String (string str);Above, the parameter str is the string to convert.ExampleLet us now see an example to implement the Convert.FromBase64String(String) method −using System; public class Demo { public static void Main(){ byte[] val1 = {5, 10, 15, 20, 25, 30}; string str = Convert.ToBase64String(val1); Console.WriteLine("Base 64 string: '{0}'", str); byte[] val2 = Convert.FromBase64String(str); Console.WriteLine("Converted byte ... Read More
To fetch the substring after last dot, use substring_index(). Let us first create a table −mysql> create table DemoTable1341 -> ( -> Value varchar(60) -> ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1341 values('John.123.@gmail.com' ); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1341 values('Carol.Taylor.gmail') ; Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1341 values('C.MyFolder.Location') ; Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select * from DemoTable1341;This will produce the following ... Read More
The CharEnumerator.ToString() method in C# gets a string that represents the current object.SyntaxFollowing is the syntax -public virtual string ToString();ExampleLet us now see an example to implement the CharEnumerator.ToString() method −using System; public class Demo { public static void Main(){ string strNum = "This is it!"; CharEnumerator ch = strNum.GetEnumerator(); Console.WriteLine("HashCode = "+ch.GetHashCode()); Console.WriteLine("Get the Type = "+ch.GetType()); Console.WriteLine("String representation = "+ch.ToString()); while (ch.MoveNext()) Console.Write(ch.Current + " "); ch.Reset(); Console.WriteLine(); ... Read More
Let us first create a table −mysql> create table DemoTable1339 -> ( -> Name varchar(30), -> Score int -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1339 values('Chris', 56); Query OK, 1 row affected (0.36 sec) mysql> insert into DemoTable1339 values('Bob', 46); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1339 values('Adam', 78); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1339 values('John', 90); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1339 values('Carol', 98); Query OK, 1 ... Read More
Let us first create a table −mysql> create table DemoTable1485 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentSubject varchar(20) -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1485(StudentName, StudentSubject) values('Chris', 'MySQL'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1485(StudentName, StudentSubject) values('Robert', 'MongoDB'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable1485(StudentName, StudentSubject) values('Robert', 'MongoDB'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable1485(StudentName, StudentSubject) ... Read More
For this, use having clause instead of where. Let us first create a table −mysql> create table DemoTable1338 -> ( -> Name varchar(10), -> Score int -> ); Query OK, 0 rows affected (1.54 sec)Insert some records in the table using insert command. Here, we have inserted duplicate names with scores −mysql> insert into DemoTable1338 values('Chris', 8); Query OK, 1 row affected (0.80 sec) mysql> insert into DemoTable1338 values('Bob', 4); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1338 values('Bob', 9); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1338 values('Chris', 6); ... Read More
For this, you can use MAX() along with substring(). Let us first create a table −mysql> create table DemoTable1337 -> ( -> Value varchar(50) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1337 values('Value400'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1337 values('Value345'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1337 values('Value567'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1337 values('Value489'); Query OK, 1 row affected (0.22 sec)Display all records from the table using select statement ... Read More
The Math.Truncate() method in C# is used to compute an integral part of a number, which is Double or Decimal.Syntaxpublic static decimal Truncate(decimal val1) public static double Truncate(double val2)Above, there are two syntaxes. The value val1 is the decimal number to truncate, whereas val2 is the double number to truncate.ExampleLet us now see an example to implement Math.Truncate() method −using System; public class Demo { public static void Main(){ Decimal val1 = 25.46467m; Decimal val2 = 45.9989m; Decimal val3 = 678.325m; Console.WriteLine(Math.Truncate(val1)); Console.WriteLine(Math.Truncate(val2)); ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP