code: public static String getFirstToken(String string, String token) {
          if ((string != null) && string.contains(token)) {
              return string.split(token)[0];
          }
          return string;
      }
docs: Returns the first token of the string if that string can be split by the token, else return the unmodified input
  string
  
  @param string The string to split
  @param token  The token to use as splitter
  @return The resultant string