-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] @everyone 이 첫줄 이어도 title로 사용하지 않습니다.
#442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| public class TitleAndContentParser { | ||
| private String title; | ||
| private String content; | ||
| private static final String EVERYONE_MENTION = "@everyone"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. static final 상수 설정 좋습니다! |
||
|
|
||
| private TitleAndContentParser(String title,String content){ | ||
| this.title=title; | ||
|
|
@@ -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++; | ||
| } | ||
|
|
||
|
|
@@ -40,5 +41,20 @@ public static TitleAndContentParser parse(String input){ | |
| return new TitleAndContentParser(title,content); | ||
| } | ||
|
|
||
| private static boolean validateTitle(String line){ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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){ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 메서드는 no use 인데 뭐죠??
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확실히 객체 분리 해놓으니까 유용하게 쓰이네요 굳!!!