只是一个文书打印,已经定义好了格式,有些位置要填数据(几十项,要用+的话偶觉得很麻烦:)
刚写了一个简单的,凑和着用,有bug或效率问题欢迎指出,都有分:)
  public static String replace(String source,String[] args)
  {
    //if(source == null || args == null ||(args.length != source.
    int start = 0;
    StringBuffer buffer = new StringBuffer(source);
    for(int i=0;i<args.length;i++)
    {
      int postion = source.indexOf("%",start);
      if((postion == -1) || ((postion+1) == source.length()))
      {
        break;
      }
      switch(source.charAt(postion + 1))
      {
        case 's':
          buffer.delete(postion,postion + 2);
          buffer.insert(postion,args[i]);
          break;
      }
      start = postion + args[i].length();
      source = buffer.toString();
    }
    return source;
  }
  public static void main(String[] args)
  {
    System.out.println(replace("abc%s%s123%s",new String[]{"abc","cde","slfjslf"}));
    System.out.println();
  }