Q:

Compare 2 strings in Java upto a delimiter

String 1:
func1(test1)

String 2:
func1(test2)

I want to compare these 2 strings upto the first open braces '('. 
So for the given example it should return true since the string upto '(' in both the strings is 'func1'. 
Is there any way to do that without splitting?

A:

String#substring() method will help on this case this combined with String#indexOf() method
String x1 = "func1(test1)";
String x2 = "func1(test1)";
String methName1 = x1.substring(0, x1.indexOf("("));
String methName2 = x2.substring(0, x2.indexOf("("));
System.out.println(methName1);
System.out.println(methName2);
System.out.println(methName1.equals(methName2));

