Guest User

Untitled

a guest
Apr 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. Insert into dual (name,date,
  2.  
  3. Insert into dual(name,date)
  4.  
  5. StringBuilder b = new StringBuilder(yourString);
  6. b.replace(yourString.lastIndexOf(","), yourString.lastIndexOf(",") + 1, ")" );
  7. yourString = b.toString();
  8.  
  9. String aResult = "Insert into dual (name,date,".replaceAll(",$", ")");
  10.  
  11. str = str.substring(0, str.lastIndexOf(",")) + ")";
  12.  
  13. String myString = "Insert into dual (name,date,";
  14. String newString = "";
  15. int length = myString.length();
  16. String lastChar = myString.substring(length-1);
  17.  
  18. if (lastChar.contains(",")) {
  19. newString = myString.substring(0,length-1) + ")";
  20. }
  21.  
  22. System.out.println(newString);
  23.  
  24. private String replaceLast(String string, String from, String to) {
  25. int lastIndex = string.lastIndexOf(from);
  26. if (lastIndex < 0) return string;
  27. String tail = string.substring(lastIndex).replaceFirst(from, to);
  28. return string.substring(0, lastIndex) + tail;
  29. }
Add Comment
Please, Sign In to add comment