Java
- 4 ответа
- 0 вопросов
1
Вклад в тег
public class CustomInterceptor extends EmptyInterceptor {
@Override
public String onPrepareStatement(String sql) {
System.err.println("Before Modifying SQL =" + sql);
sql = sql.replace("ATTENDANCE_1_2019 ", "ATTENDANCE_2_2019 ");
System.err.println("After Modifying SQL =" + sql);
return sql;
}
}
String request = "User [userid=1, firstName=Ira, lastName=Ivanova, dob=null, email=fff@gmail.com]";
int beginOfString = request.indexOf("=") + 1;
int endOfString = request.indexOf(",");
String id = request.substring(beginOfString, endOfString);
System.out.println(id);
String request = "User [userid=1, firstName=Ira, lastName=Ivanova, dob=null, email=fff@gmail.com]";
String userId = "userid=";
int beginOfString = request.indexOf(userId) + userId.length();
int endOfString = request.indexOf(",", beginOfString);
String id = request.substring(beginOfString, endOfString);
System.out.println(id);