Find a Character Except Newline Using JavaScript RegExp

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

268 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

154 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

236 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

163 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

150 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

Convert toChar Method in C#

Chandu yadav
Updated on 23-Jun-2020 07:35:47

1K+ Views

The Convert.ToChar method is used to convert a specified value to a Unicode integer.We have declared an sbyte variable.sbyte byteVal = 200;Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.charVal = Convert.ToChar(b);Let us see another example.Example Live Demousing System; public class Demo {    public static void Main() {       sbyte[] byteVal = { 92, 111, 115 };       char charVal;       foreach (sbyte b in byteVal) {          charVal = Convert.ToChar(b);          Console.WriteLine("{0} converted to '{1}'", b, charVal);       }    } }Output92 converted to '\' 111 converted to 'o' 115 converted to 's'

Convert ToDateTime Method in C#

Samual Sam
Updated on 23-Jun-2020 07:35:19

1K+ Views

The Convert.ToDateTime method converts a given value to a DateTime value.The following is my string.string myDateString; myDateString = "09/09/2018";Now, let us convert it using the Convert.ToDateTime() method.DateTime result; result = Convert.ToDateTime(myDateString);Here is the complete example.Example Live Demousing System; public class Demo {    public static void Main() {       string myDateString;       DateTime result;       myDateString = "09/09/2018";       result = Convert.ToDateTime(myDateString);       Console.WriteLine("'{0}' converted to {1}", myDateString, result);    } }Output'09/09/2018' converted to 9/9/2018 12:00:00 AM

Different Star Pattern Programs in C#

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

26K+ Views

Like any other programming languages such as C, C++, Java, we can easily display start pattern programs in C#.Let us see them one by one.Example Live Demousing System.IO; using System; class Program {    static void Main() {       for (int i = 1; i

Delete Rows in a Table Using JavaScript DOM

Sharon Christine
Updated on 23-Jun-2020 07:33:28

6K+ Views

To delete rows in a table in JavaScript, use the DOM deleteRow() method.ExampleYou can try to run the following code to learn how to delete rows in a table. The code deletes rows one at a time −Live Demo                 function captionFunc(x) {          document.getElementById(x).createCaption().innerHTML = "Demo Caption";       }                                           One             Two                                 Three             Four                                 Five             Six                                                                

Advertisements