Hi,
There are two issues with this function
1) You need to use substring and not Substring -Java is case sensitive
2) you need to do hostname.substring(5,6) and not hostname.substring(6,5) - Otherwise you will get index of bound
The result of the below function will be
Input :extractPrefixArrayName("g100bpmc002.g100.intern","d")
Output :gpd
def extractPrefixArrayName(array_name,region)
{
String hostname = splitByDelimiter(array_name,'\\.',0);
return hostname.substring(0,1)+hostname.substring(5,6)+region;
}
Note that in your function all positions are hard coded (0,1 and 5,6) ,you assume all host names length are the same -not sure if this is indeed true
Hope it helps