Java代码 excel java concat _java excel java concat _excel_02

  1.  
  2.  
  3. public class ExcelConcat {
  4. private static final String quote = "\"'\"";
  5. private static final String dquote = "\"";
  6. private static final String and = "&";
  7. private static final String coma = "\",\"";
  8. private static final char col_start= 'a';
  9. private static final char col_end = 'g';
  10. private static final int row = 2;
  11. /**
  12. * @param args
  13. */
  14. public static void main(String[] args) {
  15. // TODO Auto-generated method stub
  16. StringBuilder buff = new StringBuilder();
  17. buff.append("="+dquote+"insert into Table values("+dquote);
  18. for( char i=col_start;i<=col_end;i++){
  19. buff.append(and+quote+and+i+row+and+quote);
  20. if(i<col_end){
  21. buff.append(and+coma);
  22. }
  23. }
  24. buff.append(and+"\"); commmit;\"");
  25. System.out.println(buff.toString());
  26. }
  27.  
  28. }