Scanner delimiter() in Java

delimiter(): This method is available in java.util.Scanner class of Java.

Syntax:

Pattern java.util.Scanner.delimiter()

This method returns the Pattern this Scanner is currently using to match delimiters.

Parameters: NA

Returns: this scanner's delimiting pattern.

Exceptions: NA

Approach

Java

import java.util.Scanner;

public class Scannerdelimiter {
    public static void main(String[] args) {

        String source = "Hello World";
        Scanner scanner = new Scanner(source);

        System.out.println(scanner.delimiter());
        scanner.close();
    }
}

Output:

\p{javaWhitespace}+


No comments:

Post a Comment