[IT]/java
java. uri에서 contextPath와 .do를 제외한 FindCarController추출
givemebro
2021. 4. 19. 16:29
반응형
package test;
public class TestUnitString {
public static void main(String[] args) {
String uri = "/webstudy17-test/RegisterCarController.do";
String contextPath = "/webstudy17-test";
// 위 uri 문자열을 contextPath와 .do를 제외한 FindCarController 만 추출
System.out.println(contextPath.length());
// substring(begin, endIndexx)
System.out.println(uri.substring(contextPath.length() + 1, uri.length() - 3));
}
}
반응형