public static String field ( EvaluationContext ctx , Object text , Object index , @ StringDefault ( " " ) Object delimiter ) { String _text = Conversions . toString ( text , ctx ) ; int _index = Conversions . toInteger ( index , ctx ) ; String _delimiter = Conversions . toString ( delimiter , ctx ) ; String [ ] splits = StringUtils . splitByWholeSeparator ( _text , _delimiter ) ; if ( _index < 1 ) { throw new RuntimeException ( "Field index cannot be less than 1" ) ; } if ( _index <= splits . length ) { return splits [ _index - 1 ] ; } else { return "" ; } }
Reference a field in string separated by a delimiter