Skip to content

Commit

Permalink
PostService [fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchiim committed Apr 21, 2023
1 parent b911ba0 commit aeca861
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public String getPostInfo(Long UserId) { // 아이디로 글을 찾는 메서드

public String getByTitle(String title) { // 찾는 제목을 포함하는 게시물을 찾는 메서드
ArrayList<String> titlePost = new ArrayList<>(); // 일회성 Array를 만들어주고 싶었습니다.
for(int i = 0 ; i < postList.size() ; i++) {
Post post = postList.get(i);
if (post.getTitle().contains(title)){ // 검색한 String과 일치하는 타이틀 조건
titlePost.add(post.toString()); // id,title,content 모두 나오게 설정
for(Post post: postList) {
if (post.getTitle().contains(title)){
titlePost.add(post.toString());
}
}
return "해당 제목을 포함하는 게시물: " + titlePost;
Expand Down

0 comments on commit aeca861

Please sign in to comment.