Thursday, 15 October 2015

Getting the content inside the Parenthesis in a whole String, using split() Input : (AMITABH) BACCHAN output : AMITABH

In order to get the content inside the Parenthesis of a whole String,  we can use the below code.


public class HelloWorld {
  public static void main(String[] args) {
    String str = "jhjh  (Environment) ab- ghty";
    System.out.println((str.split("\\(")[1]).split("\\)")[0]);
  }

}

In Talend you can use the below code :

(!(Relational.ISNULL(row2.Consequence)) && !(row2.Consequence.toString().isEmpty())) ? (row2.Consequence.split("\\(")[1]).split("\\)")[0] : null;

String  : (AMITABH) BACCHAN

Output : AMITABH


get it

 http://hinekv1.ddns.net:8008/get.php?username=Varga_Florentina1tv&password=j5MgWBs18t&type=m3u_plus&output=mpegts http://www.lo...