[StartsWith] 함수
https://docs.oracle.com/javase/7/docs/api/java/lang/String.html
String (Java Platform SE 7 )
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argum
docs.oracle.com
StartsWith 함수란, String이 특정한 값으로 시작하는지 확인하는 함수이다.
이 함수는 다음과 같이 사용한다.
public boolean startsWith (String prefix)
//사용 방법
String first = "123";
Stirng second = "12";
String end = "456";
first.startsWith(second) = true;
first.startsWith(end) = false;
1. 비교하고자 하는 문자열의 character의 접두어가 같으면, true를 반환하고 다르면 false를 반환한다.
2. 만약, 두 문자열이 동일할경우 equals함수와 동일하게 작동을 한다.
3. 만약 argument가 null일 경우에도 true를 반환한다.
endsWith함수는 String이 특정한 값으로 끝나는지 확인하는 함수이다.
public boolean endsWith (String prefix)
//사용 방법
String end = "456";
String first = "56";
Stirng second = "12";
end.endsWith(first) = true;
end.endsWith(second) = false;
1. 비교하고자 하는 문자열의 character의 접미어가 같으면, true를 반환하고 다르면 false를 반환한다.
2. 만약 두 문자열이 동일할 경우 equals함수와 동일하게 작동한다.
3. arugument가 null일 경우에는 true를 반환한다.