Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public class TitleAndContentParser {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확실히 객체 분리 해놓으니까 유용하게 쓰이네요 굳!!!

private String title;
private String content;
private static final String EVERYONE_MENTION = "@everyone";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static final 상수 설정 좋습니다!


private TitleAndContentParser(String title,String content){
this.title=title;
Expand All @@ -25,7 +26,7 @@ public static TitleAndContentParser parse(String input){
int index = 0;

// 첫 줄이 비어있으면 다음 줄로 이동
while (index < lines.length && lines[index].isBlank()) {
while (index < lines.length && !validateTitle(lines[index])) {
index++;
}

Expand All @@ -40,5 +41,20 @@ public static TitleAndContentParser parse(String input){
return new TitleAndContentParser(title,content);
}

private static boolean validateTitle(String line){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메서드 분리 굳!

if(line.isEmpty()||line.isBlank()){return false;}
if(line.trim().equalsIgnoreCase(EVERYONE_MENTION)){return false;}

return true;
}

private static String deleteMention(String input){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 메서드는 no use 인데 뭐죠??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정해서 올렸습니다

if(input==null){
return null;
}
if(input.contains(EVERYONE_MENTION)){
return input.replace(EVERYONE_MENTION, "");
}
return input;
}
}