@@ -0,0 +1,2261 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage at.illecker.storm.examples.util;%0A%0Apublic class StringUtils %7B%0A%0A  public static boolean isPunctuation(char c) %7B%0A    return c == ',' %7C%7C c == '.' %7C%7C c == '!' %7C%7C c == '?' %7C%7C c == ':' %7C%7C c == ';';%0A  %7D%0A%0A  public static boolean isSpecialChar(char c) %7B%0A    return c == '-' %7C%7C c == '_' %7C%7C c == '&' %7C%7C c == '%7C' %7C%7C c == '/'%0A        %7C%7C c == '%5C%5C' %7C%7C c == '%22' %7C%7C c == '%5C'' %7C%7C c == '%60' %7C%7C c == '%C2%B4';%0A  %7D%0A%0A  public static String trimPunctuation(String value) %7B%0A    int valueLen = value.length();%0A%0A    // count starting punctuations%0A    int startingPunctuations = 0;%0A    for (int i = 0; i %3C valueLen; i++) %7B%0A      if (isPunctuation(value.charAt(i)) %7C%7C isSpecialChar((value.charAt(i)))) %7B%0A        startingPunctuations++;%0A      %7D else %7B%0A        break;%0A      %7D%0A    %7D%0A%0A    // count ending punctuations%0A    int endingPunctuations = 0;%0A    for (int i = valueLen - 1; i %3E= 0; i--) %7B%0A      if (isPunctuation(value.charAt(i)) %7C%7C isSpecialChar((value.charAt(i)))) %7B%0A        endingPunctuations++;%0A      %7D else %7B%0A        break;%0A      %7D%0A    %7D%0A%0A    // case 1) no characters were punctuation%0A    if ((startingPunctuations == 0) && (endingPunctuations == 0)) %7B%0A      return value;%0A    %7D%0A%0A    // case 2) all characters were punctuation%0A    if ((startingPunctuations == valueLen) && (endingPunctuations == valueLen)) %7B%0A      return %22%22;%0A    %7D%0A%0A    // case 3) substring%0A    return value.substring(startingPunctuations, valueLen - endingPunctuations%0A        - startingPunctuations);%0A  %7D%0A%0A%7D%0A

Add StringUtils