Create Table Caption with JavaScript DOM

Jai Janardhan
Updated on 23-Jun-2020 07:32:58

627 Views

To create a table caption, use the DOM createCaption() method.ExampleYou can try to run the following code to learn how to create table caption −Live Demo                    function captionFunc(x) {             document.getElementById(x).createCaption().innerHTML = "Demo Caption";          }                                           One             Two                                 Three             Four                                 Five             Six                                          

C# Program to Merge Sequences

karthikeya Boyini
Updated on 23-Jun-2020 07:32:51

228 Views

Let’s add two sequences.Integer Array.int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 };String Array.string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino" };Now to merge both the above sequences, use the Zip method.ntArray.AsQueryable().Zip(stringArray, (one, two) => one + " " + two);Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo {    public static void Main() {       int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 };       string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino"   ... Read More

Perform Multiline Matching with JavaScript RegExp

Moumita
Updated on 23-Jun-2020 07:32:31

672 Views

To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching −           JavaScript Regular Expression                        var myStr = "Welcoming!";          var reg = /^ing/m;          var match = myStr.match(reg);                    document.write(match);          

C# Program to Create a Linked List

Arjun Thakur
Updated on 23-Jun-2020 07:32:15

324 Views

Firstly, set a string array.string [] students = {"Tim","Jack","Henry","David","Tom"};Now, add it to the LinkedList.LinkedList list = new LinkedList(students);The above creates a LinkedList and adds node to it.Let us see the complete example.Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       string [] students = {"Tim","Jack","Henry","David","Tom"};       LinkedList list = new LinkedList(students);       foreach (var stu in list) {          Console.WriteLine(stu);       }    } }OutputTim Jack Henry David Tom

JavaScript RegExp to Find Alternative Text

Nikitha N
Updated on 23-Jun-2020 07:32:05

251 Views

To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text −           JavaScript Regular Expression                        var myStr = "one,one,one, two, three, four, four";          var reg = /(one|two|three)/g;          var match = myStr.match(reg);          document.write(match);          

C# Program to Invert the Order of Elements in a Sequence

Samual Sam
Updated on 23-Jun-2020 07:31:48

224 Views

Set a string.char[] ch = { 'd', 'r', 'i', 'v', 'e' }; Console.Write("String = foreach(char arr in ch) Console.Write(arr);Now, use Queryable Reverse() method to invert the order of elements.IQueryable res = ch.AsQueryable().Reverse();Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo {    public static void Main() {       char[] ch = { 'd', 'r', 'i', 'v', 'e' };       Console.Write("String = ");       foreach(char arr in ch)       Console.Write(arr);       IQueryable res = ch.AsQueryable().Reverse();       Console.Write("Reversed = ");       foreach (char c in res)       Console.Write(c);    } }OutputString = drive Reversed = evird

C# Program to Get Current Day of Week

Ankith Reddy
Updated on 23-Jun-2020 07:31:14

16K+ Views

Use DateTime. DayOfWeek property to display the current day of week.DayOfWeek wk = DateTime.Today.DayOfWeek;Now, displaying “wk” would give you the current day of the week.Let us see the complete code to get the current day of week.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DayOfWeek wk = DateTime.Today.DayOfWeek;       Console.WriteLine(wk);    } }OutputWednesday

Check Sequence Elements Satisfy Condition in C#

karthikeya Boyini
Updated on 23-Jun-2020 07:30:47

399 Views

Use All() Method to check whether the elements of a sequence satisfy a condition or not. Even if one of the element do not satisfy the set condition, the All() method returns False.To set conditions, use Lambda Expressions. Below shows a condition to check whether all the elements are greater than 20 or not.myArr.AsQueryable().All(val => val > 20);Let us see an example.Example Live Demousing System; using System.Linq; class Demo {    static void Main() {       int[] myArr = {7, 15, 22, 30, 40};       // checking if all the array elements are greater than 20       bool res = myArr.AsQueryable().All(val => val > 20);       Console.WriteLine(res);    } }OutputFalse

Initialize an Empty DateTime in C#

Samual Sam
Updated on 23-Jun-2020 07:30:24

3K+ Views

Set a DateTime to its minimum value.DateTime.MinValue;The above will display the minimum value i.e.1/1/0001Let us see how to display the minimum value and avoid adding null to a date to initialize it as empty.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime dt = DateTime.MinValue;       Console.WriteLine(dt);    } }Output1/1/0001 12:00:00 AM

Generate Current Month in C#

George John
Updated on 23-Jun-2020 07:29:56

11K+ Views

To display current month, firstly use “Now“ to get the current date.DateTime dt = DateTime.Now;Now, use the Month property to get the current month.dt.MonthLet us see the complete code.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime dt = DateTime.Now;       Console.WriteLine(dt.Month);    } }Output9To display current month’s name.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime dt = DateTime.Now;       Console.WriteLine(dt.ToString("MMM"));    } }OutputSep

Advertisements