code: public static String maxTruncStr(String source, int maxNrChars) {
          if (source != null && source.length() > maxNrChars) {
              return source.substring(0, maxNrChars);
          } else {
              return source;
          }
      }
docs: Truncates the String at maxNrChars.
  
  @param source
  @param maxNrChars
  @return