Write JavaScript RegExp to Match an Expression

Nikitha N
Updated on 23-Jun-2020 07:41:44

124 Views

To match an expression, use the JavaScript match() method. This method is used to retrieve the matches when matching a string against a regular expression. The following is the parameter −param − A regular expression object.If the regular expression does not include the g flag, it returns the same result as regexp.exec(string).If the regular expression includes the g flag, the method returns an Array containing all the matches.ExampleYou can try to run the following code to math an expression using JavaScript Regular Expression −           JavaScript String match() Method               ... Read More

Add Node at Last Position in a Linked List - C# Program

karthikeya Boyini
Updated on 23-Jun-2020 07:41:13

232 Views

Set a LinkedList with nodes.string [] students = {"Tim", "Jack", "Henry", "David", "Tom"}; LinkedList list = new LinkedList(students);Now, use the AddLast() method to add a node at the last position.list.AddLast("Kevin");Here is the complete code with the updated LinkedList.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);       }       // adding a node at the end     ... Read More

Usage of in Operator in JavaScript

Arushi
Updated on 23-Jun-2020 07:41:06

153 Views

The operator is used in JavaScript to check whether a property is in an object or not.ExampleYou can try to run the following code to learn how to use in operator in JavaScript −Live Demo                    var emp = {name:"Amit", subject:"Java"};          document.write("name" in emp);          document.write("");          document.write("subject" in emp);          document.write("");          document.write("MAX_VALUE" in Number);          document.write("");          document.write("MIN" in Number);          

C# Program to Find the Average of a Sequence of Numeric Values

Samual Sam
Updated on 23-Jun-2020 07:40:42

4K+ Views

Use the Linq Average() method to find the average of a sequence of numeric values.Firstly, set a sequence.List list = new List { 5, 8, 13, 35, 67 };Now, use the Queryable Average() method to get the average.Queryable.Average(list.AsQueryable());Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo {    static void Main() {       List list = new List { 5, 8, 13, 35, 67 };       double avg = Queryable.Average(list.AsQueryable());       Console.WriteLine("Average = "+avg);    } }OutputAverage = 25.6

Find a Character Except Newline Using JavaScript RegExp

Anvi Jain
Updated on 23-Jun-2020 07:40:33

252 Views

To find a character except for a newline, use the Metacharacter. (period). You can try to run the following code to find a character −Example           JavaScript Regular Expression                        var myStr = "We provide websites! We provide content!";          var reg = /p.o/g;          var match = myStr.match(reg);                    document.write(match);          

Chash into Keyword

Ankith Reddy
Updated on 23-Jun-2020 07:40:16

139 Views

Set query in a select clause using the into operator.The following is our list with Employee details −IList employee = new List() {    new Employee() { EmpID = 1, EmpName = "Tom", EmpMarks = 90, Rank = 8} ,    new Employee() { EmpID = 2, EmpName = "Anne", EmpMarks = 60, Rank = 21 } ,    new Employee() { EmpID = 3, EmpName = "Jack", EmpMarks = 76, Rank = 18 } ,    new Employee() { EmpID = 4, EmpName = "Amy" , EmpMarks = 67, Rank = 20} , };Now, fetch employee name that ends ... Read More

Set Milliseconds for Specified Date According to Universal Time

Nishtha Thakur
Updated on 23-Jun-2020 07:38:52

219 Views

Javascript date setUTCMilliseconds() method sets the milliseconds for a specified date according to universal time.The following is the parameter for setUTCMilliseconds(millisecondsValue) −millisecondsValue − A number between 0 and 999, representing the milliseconds.ExampleYou can try to run the following code to set the milliseconds for a specified date according to universal time −           JavaScript setUTCMilliseconds Method                        var dt = new Date( "Aug 28, 2008 23:30:00" );          dt.setUTCMilliseconds( 1200 );                    document.write( dt );          

C# Console BufferHeight Property

Chandu yadav
Updated on 23-Jun-2020 07:38:38

150 Views

Use the BufferHeight gets or sets the height of the buffer area.Use the property like this −Console.BufferHeightLet us see the complete example.Example Live Demousing System; class Demo {    static void Main() {       Console.WriteLine("Buffer height (rows) = "+Console.BufferHeight);    } }OutputBuffer height (rows) = 0

Display Default if Element is Not Found in a Hash List

George John
Updated on 23-Jun-2020 07:37:32

139 Views

We have a list without any element.List val = new List { };To display the default and avoid any error, use the FirstorDefault() method.val.AsQueryable().FirstOrDefault();You can also change the value to be displayed as default.Let us see the code.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       List val = new List{ };       float a = val.AsQueryable().FirstOrDefault();       Console.WriteLine("Default Value = "+a);       if (a == 0.0f) {          a = 0.1f;       }       Console.WriteLine("Default Float value updated = "+a);    } }OutputDefault Value = 0 Default Float value updated = 0.1

Difference Between TimeSpan Seconds and TotalSeconds

karthikeya Boyini
Updated on 23-Jun-2020 07:36:57

4K+ Views

TimeSpan Seconds() is part of time, whereas TimeSpan TotalSeconds() converts entire time to seconds.Let us first see the TimeSpan Seconds() method.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);       // seconds       Console.WriteLine(ts.Seconds);    } }Output20Now, let us see how TotalSeconds works for the same TimeSpan value.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);       // ... Read More

Advertisements