Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2794

Re: java experts

$
0
0

Hi Venky,

 

Use below UDF

 

public String split(String input, Container container) throws StreamTransformationException {  StringBuilder sb = new StringBuilder();  input = " " + input;  String patternStr = "\\s[A-Z0-9]{2}\\-";  Pattern pattern = Pattern.compile(patternStr);  Matcher matcher = pattern.matcher(input);  List<Integer> indexes = new ArrayList<Integer>();  while (matcher.find()) {  indexes.add(matcher.start());  }  for (int i = 0; i < indexes.size(); i++) {  int endIndex = indexes.size() > i + 1 ? indexes.get(i + 1) : input.length();  String token = input.substring(indexes.get(i), endIndex);  token = token.substring(1);  if (token.startsWith("E2-") || token.startsWith("GI-"))  sb.append(token.substring(3).replace("-", "|")).append("|");  }  sb.setLength(sb.length() - 1);  return sb.toString();  }

Regards,

Praveen.


Viewing all articles
Browse latest Browse all 2794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>