Difference Between AND Operator in PHP

Mahesh Parahar
Updated on 13-Jan-2020 06:33:04

560 Views

'!==' comparison operator'!==' operator checks the unequality of two objects with a type check. It does not converts the datatype and makes a typed check.For example 1 !== '1' will results true.'==!' comparison operator'==!' operator is combination of two operators and can be written as == (!operands).ExampleFollowing example, shows usage of '!==' vs '==!' operators. Live Demo    PHP Example     Output$x !== operator $y = bool(true) $x ==! operator $y = bool(true)

Finding a Match Within Another Match in Java Regular Expressions

Maruthi Krishna
Updated on 13-Jan-2020 06:30:59

312 Views

To match a pattern within another match you need to compile the regular expression to match the outer pattern find the match retrieve the results and pass the results as input to the inner Matcher object.Example Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatcherExample {    public static void main(String[] args) {       int start = 0, len = -1;       Scanner sc = new Scanner(System.in);       System.out.println("Enter input text: ");       String input = sc.nextLine();       String regexOuter = "(.*?)";       String regexInner = "\d+";   ... Read More

Difference Between parseInt() and Number() in JavaScript

V Jyothi
Updated on 13-Jan-2020 06:29:41

282 Views

parseInt(string)The parseInt() method parses up to the first non-digit and returns the parsed value.  For example, the following returns 765:parseInt("765world")Let’s take another example. The following returns 50:parseInt(‘50px”);Number(string)Number() converts the string into a number, which can also be a float BTW.For example, the following returns NaN:Number(“765world”)The following returns NaN:Number(“50px”);

Difference Between AND Operator in JavaScript

Mahesh Parahar
Updated on 13-Jan-2020 06:28:36

612 Views

'!=' comparison operator'!=' operator checks the unequality of two objects without making the type check. It converts the datatype of two operands to one and then compares their value. For example 1 != '1' will results false.'!==' comparison operator'!==' operator checks the unequality of two objects with a type check. It does not converts the datatype and makes a typed check.For example 1 !== '1' will results true.Following example, shows usage of '!=' vs '!==' operators.Example    Operator Example           console.log(" 1 != '1' " + (1 != '1'));       ... Read More

Getting the List of All Matches in Java Regular Expressions

Maruthi Krishna
Updated on 13-Jan-2020 06:27:52

11K+ Views

Java does not provide any method to retrieve the list of all matches we need to use Lists and add the results to it in the while loop.Example Live Demoimport java.util.ArrayList; import java.util.Iterator; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ListOfMatches{    public static void main(String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter input text: ");       String input = sc.nextLine();       String regex = "\d+";       //Creating a pattern object       Pattern pattern = Pattern.compile(regex);       ArrayList list = new ArrayList();   ... Read More

Redirect to a Different URL Using Window Location

Jai Janardhan
Updated on 13-Jan-2020 06:26:55

1K+ Views

You might have encountered a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.It is quite simple to do a page redirect using JavaScript on the client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows.ExampleYou can try to run the following code to learn how to use window.location to redirect an HTML page. Here, we will redirect to the home pageLive Demo           ... Read More

Use Meta Tag to Redirect an HTML Page

Paul Richard
Updated on 13-Jan-2020 06:26:03

13K+ Views

Page redirection is a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.To use a META Tag to redirect your site is quite easy. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute.The following is an example of redirecting current page to another page after 2 seconds. If you want to redirect page immediately then do not specify the content attribute.ExampleLive Demo           HTML Meta Tag                     This is demo text.    

Difference Between Class and ID Selector in CSS

Mahesh Parahar
Updated on 13-Jan-2020 06:23:56

2K+ Views

'.' selector'.' selector is a class level selector. The dot operator is used to create a style class which can then be applied on multiple html elements.'#' selector'#' selector is an element level selector. Hash operator is used to applying style on a particular element whose id is the same as used in '#' selectorExampleFollowing the example, shows usage of '.' as well as '#' selector on three div elements.    Selector Example>/title>           .blackBorder {          border: 2px solid black;       }       #redDiv {   ... Read More

Determine Position and Length of Match in Java Regex

Maruthi Krishna
Updated on 13-Jan-2020 06:22:03

1K+ Views

The start() method of the java.util.regex.Matcher class returns the starting position of the match (if a match occurred).Similarly, the end() method of the Matcher class returns the ending position of the match.Therefore, return value of the start() method will be the starting position of the match and the difference between the return values of the end() and start() methods will be the length of the match.Example Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatcherExample {    public static void main(String[] args) {       int start = 0, len = -1;       Scanner sc = new ... Read More

Matching a Whole Word in Java Regular Expressions

Maruthi Krishna
Updated on 13-Jan-2020 06:12:00

2K+ Views

The meta character "\b" matches word boundaries. i.e. it matches before the first and after the last word characters and between word and non-word characters.Therefore to match a whole word you need to surround it between the word boundary meta characters as −\btest\bExample Live DemoFollowing Java example counts and prints the number of occurrences of the word test in the given input string.import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample1 {    public static void main(String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter input text: ");       String input = sc.nextLine(); ... Read More

Advertisements