Maruthi Krishna has Published 870 Articles

How to write an image using Java OpenCV library?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Apr-2020 13:53:05

716 Views

Using the OpenCV library you can perform image processing operations such as image filtering, geometrical image transformations, color space conversion, histograms, etc.Writing an imageWhenever you read the contents of an image using the imread() method of the Imgcodecs class the result is read into the Matrix object.You can write/save an ... Read More

Non capturing groups Java regular expressions:

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 11:31:41

1K+ Views

Using capturing groups you can treat multiple characters as a single unit. You just need to place the characters to be grouped inside a set of parentheses. For example −(.*)(\d+)(.*)If you are trying to match multiple groups the match results of each group is captured. You can get the results ... Read More

Java regex program to match parenthesis "(" or, ")".

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 11:27:01

6K+ Views

Following regular expression accepts a string with parenthesis −"^.*[\(\)].*$";^ matches the starting of the sentence..* Matches zero or more (any) characters.[\(\)] matching parenthesis.$ indicates the end of the sentence.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SampleTest {    public static void main( String args[] ) {   ... Read More

Regular Expression Q Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 11:21:57

1K+ Views

The subexpression/metacharacter "\Q" escapes all characters up to "\E" i.e. you can escape metacharacters in the regular expressions by placing them in between \Q and \E. For example, the expression [aeiou] matches the strings with vowel letters in it.Example  Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SampleProgram {   ... Read More

Posix character classes p{Blank} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 11:11:04

300 Views

This class matches all tabs or spaces.Example  Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class PrintableCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input ... Read More

Posix character classes p{InGreek} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 11:08:43

340 Views

This class \p{InGreek} matches Greek characters.Example Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example1 {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input = ... Read More

Posix character classes p{Alnum} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 21-Feb-2020 10:59:03

722 Views

This class matches alpha numeric characters.Example  Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class AlphanumericExample {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String input = ... Read More

Custom UnaryOperator implementation in java.

Maruthi Krishna

Maruthi Krishna

Updated on 20-Feb-2020 12:04:09

434 Views

The java.util.function.UnaryOperator interface and can be used as assignment target for lambda expressions, it represents operation on a single operand whose result will be of same type as the input. We can create our own UnaryOperator by implementing this interface.The replaceAll() method of the List interface accept an object of ... Read More

What are wildcards arguments in Generics In Java?

Maruthi Krishna

Maruthi Krishna

Updated on 21-Jan-2020 12:16:39

2K+ Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class ... Read More

Character class: union - Java regular expressions

Maruthi Krishna

Maruthi Krishna

Updated on 13-Jan-2020 06:52:15

563 Views

The character classes in Java regular expression is defined using the square brackets "[ ]", this subexpression matches a single character from the specified or, set of possible characters. For example the regular expression [abc] matches a single character a or, b or, c.The union variant of the character class ... Read More

Advertisements