File tree Expand file tree Collapse file tree
src/main/java/calculator/service/separator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66public class Separator {
77
8+ /**
9+ * 커스텀 구분자가 있는지 확인한다. 만약 있다면, checkSeparatorDto.customSeparator 에 null 대신 커스텀 구분자를 넣는다. 또한,
10+ * checkSeparatorDto.inputString 에 커스텀 구분자를 확인하는 부분을 제거한 문자열을 넣는다.
11+ *
12+ * @param checkSeparatorDto inputString 만 set 되어 있는 dto.
13+ */
814 public void checkCustomSeparator (CheckSeparatorDto checkSeparatorDto ) {
915 String inputString = checkSeparatorDto .getInputString ();
1016 String customSeparator ;
17+
1118 if (inputString .length () >= CalConst .MINIMUM_LENGTH_IF_EXIST_CUSTOM_SEPARATOR .value ()
1219 && inputString .startsWith ("//" )
1320 && inputString .startsWith ("\\ n" , CalConst .END_INDEX_OF_CUSTOM_SEPARATOR .value ())) {
@@ -19,10 +26,17 @@ public void checkCustomSeparator(CheckSeparatorDto checkSeparatorDto) {
1926 }
2027 }
2128
29+ /**
30+ * 문자열을 구분자를 이용해 나눈다.
31+ *
32+ * @param checkSeparatorDto 커스텀 구분자(or null)와 커스텀 구분자 확인 부분을 제거한 문자열을 넣은 Dto.
33+ * @return 구분자를 이용해 나눠진 문자열을 반환한다. 이 문자열에는 숫자 외의 문자가 존재할 수 있다. 계산에 이용하려면 추가적인 확인 과정이 필요하다.
34+ */
2235 public String [] separate (CheckSeparatorDto checkSeparatorDto ) {
2336 String customSeparator = checkSeparatorDto .getCustomSeparator ();
2437 String inputString = checkSeparatorDto .getInputString ();
25- if (customSeparator ==null ) {
38+
39+ if (customSeparator == null ) {
2640 return inputString .split ("[:,]" );
2741 }
2842 if (customSeparator .equals ("\\ " )) {
You can’t perform that action at this time.
0 commit comments