Find Longest String from Array Using Lambda Expression in C#

Chandu yadav
Updated on 23-Jun-2020 07:56:57

1K+ Views

The following is our string array −string[] arr = { "Java", "HTML", "CSS", "JavaScript"};Use the Aggregate method and set a Lambda Expression to find the string with more number of characters.Here, the resultant string should have more number of characters than the initial seed value i.e. “jQuery” here.Example Live Demousing System; using System.Linq; class Demo {    static void Main() {       string[] arr = { "Java", "HTML", "CSS", "JavaScript"};       string res = arr.AsQueryable().Aggregate("jQuery", (longest, next) => next.Length >       longest.Length ? next : longest, str => str.ToLower());       Console.WriteLine("String with more ... Read More

Role of pageXOffset Property in JavaScript

Samual Sam
Updated on 23-Jun-2020 07:56:50

277 Views

If you want to get the pixels the document scrolled to from the upper left corner of the window, then use the pageXoffset and pageYoffset property. Use pageXoffset for horizontal pixels.ExampleYou can try to run the following code to learn how to work with pageXOffset property in JavaScript −Live Demo                    div {             background-color: green;             height: 1500px;             width: 1500px;          }                              function scrollFunc() {             window.scrollBy(200, 200);             alert("Horizonal: " + window.pageXOffset);          }             Scroll                      

Match Unicode Character Specified by Hexadecimal Number

Alankritha Ammu
Updated on 23-Jun-2020 07:56:14

355 Views

To match a Unicode character specified by the hexadecimal number xxx with JavaScript Regular Expression, use the following −\uxxxxExampleYou can try to run the following code to match the hexadecimal number character xxxx. It matches the hexadecimal number 53 i.e. S −           JavaScript Regular Expression                        var myStr = "Secure and Responsive!";          var reg = /\u0053/g;          var match = myStr.match(reg);                    document.write(match);          

Search a Hexadecimal Number Character Using JavaScript RegExp

Smita Kapse
Updated on 23-Jun-2020 07:55:32

426 Views

To find a hexadecimal number character with JavaScript Regular Expression, use the following. Add the hexadecimal number here −\xddExampleYou can try to run the following code to find hexadecimal number character. It searches for hexadecimal number 53 i.e. S −           JavaScript Regular Expression                        var myStr = "Secure and Responsive!";          var reg = /\x53/g;          var match = myStr.match(reg);                    document.write(match);          

Remove First Element from LinkedList in C#

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

546 Views

Let’s say the following is our LinkedList with integer nodes.int [] num = {29, 40, 67, 89, 198, 234}; LinkedList myList = new LinkedList(num);Now, if you want to remove the first element from the list, then use the RemoveFirst() method.myList.RemoveFirst();Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       int [] num = {29, 40, 67, 89, 198, 234};       LinkedList myList = new LinkedList(num);       foreach (var n in myList) {          Console.WriteLine(n);       }       // removing first node       myList.RemoveFirst();       Console.WriteLine("LinkedList after removing the first node...");       foreach (var n in myList) {          Console.WriteLine(n);       }    } }Output29 40 67 89 198 234 LinkedList after removing the first node... 40 67 89 198 234

Convert Date to String Using Current Locale's Conventions

Manikanth Mani
Updated on 23-Jun-2020 07:54:51

224 Views

JavaScript date toLocaleString() method converts a date to a string, using the operating system's local conventions.The toLocaleString method relies on the underlying operating system in formatting dates. It converts the date to a string using the formatting convention of the operating system where the script is running. For example, in the United States, the month appears before the date (04/15/98), whereas in Germany the date appears before the month (15.04.98).ExampleYou can try to run the following code to learn how to convert a date to a string using current locale’s conventions −           JavaScript toLocaleString Method ... Read More

What is availWidth Property in JavaScript

Sharon Christine
Updated on 23-Jun-2020 07:54:22

117 Views

Use the screen.availWidth property to return the width of the user’s screen. The result will be in pixels and the Taskbar feature won’t be included.ExampleYou can try to run the following code to learn how to work with the screen.availWidth property in JavaScript −Live Demo                    document.write("Width of the user’s screen: "+screen.availWidth);          

Implicit Conversion from Int32 to Decimal in C#

George John
Updated on 23-Jun-2020 07:54:11

2K+ Views

The int type represents a 32-bit signed integer i.e. Int32.To implicitly convert an Int32 to a Decimal, firstly set a Int32 value.int val = 392;To convert Int32 to decimal, assign the value.decimal d; d = val;Let us see another example.Exampleusing System; public class Demo {    public static void Main() {       int val = 767;       decimal d;       Console.WriteLine("Implicit conversion from Int32 (integer) to Decimal");       d = val;       Console.WriteLine("Decimal : "+dec);    } }

Search String for Text Matching RegExp in JavaScript

Priya Pallavi
Updated on 23-Jun-2020 07:53:50

237 Views

To search a string for a text that matches RegExp, use rhe exec() method in JavaScript. If it finds a match, it returns an array of results; otherwise, it returns null.The following is the parameter −string − The string to be searchedExampleYou can try to run the following code to search a string for text matching RegExp −           JavaScript RegExp exec Method                        var str = "JavaScript is an interesting scripting language";          var re = new RegExp( "script", "g" ); ... Read More

Remove Node at the Beginning of a Linked List in C#

Samual Sam
Updated on 23-Jun-2020 07:53:38

221 Views

To remove a node at the beginning of a LinkedList, use the RemoveFirst() method.string [] employees = {"Peter", "Robert", "John", "Jacob"}; LinkedList list = new LinkedList(employees);Now, to remove the first element, use the RemoveFirst() method.list.RemoveFirst();Let us see the complete example.Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       string [] employees = {"Peter", "Robert", "John", "Jacob"};       LinkedList list = new LinkedList(employees);       foreach (var emp in list) {          Console.WriteLine(emp);       }       // removing first node       list.RemoveFirst(); ... Read More

Advertisements