Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Insert into dual (name,date,
- Insert into dual(name,date)
- StringBuilder b = new StringBuilder(yourString);
- b.replace(yourString.lastIndexOf(","), yourString.lastIndexOf(",") + 1, ")" );
- yourString = b.toString();
- String aResult = "Insert into dual (name,date,".replaceAll(",$", ")");
- str = str.substring(0, str.lastIndexOf(",")) + ")";
- String myString = "Insert into dual (name,date,";
- String newString = "";
- int length = myString.length();
- String lastChar = myString.substring(length-1);
- if (lastChar.contains(",")) {
- newString = myString.substring(0,length-1) + ")";
- }
- System.out.println(newString);
- private String replaceLast(String string, String from, String to) {
- int lastIndex = string.lastIndexOf(from);
- if (lastIndex < 0) return string;
- String tail = string.substring(lastIndex).replaceFirst(from, to);
- return string.substring(0, lastIndex) + tail;
- }
Add Comment
Please, Sign In to add comment