code: private String convertString(String str, String format, String expr)
      {
          String ret = str;
  
          String[] params = null;
          if(format.length() > 0)
          {
              ret = "";
              if(expr.length() > 0) // Indicates a format using regex
              {
  
                  Pattern pattern = getPattern(expr);
                  Matcher m = pattern.matcher(str);
                  if(m.find())
                  {
                      params = new String[m.groupCount()];
                      for(int i = 0; i < m.groupCount(); i++)
                          params[i] = m.group(i+1);
                  }
              }
              else if(str != null)
              {
                  params = new String[]{str};
              }
  
              if(params != null)
                  ret = String.format(format, params);
          }
  
          return ret;
      }
docs: Converts the given string value to the output string format.
  @param str The value to be converted
  @param format The format to use for the value
  @param expr A regex to use for formatting the value
  @return The formatted value