-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/mpnp/baechelin/common/DataClarification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
package com.mpnp.baechelin.common; | ||
|
||
import com.mpnp.baechelin.store.domain.Category; | ||
|
||
public class DataClarification { | ||
public static String clarifyString(String input){ | ||
// Trim | ||
input = input.trim(); | ||
// replace all blanks | ||
return input.replaceAll("\\s+", " "); | ||
} | ||
/** | ||
* @param category 변환할 카테고리 | ||
* @return 카테고리의 중분류를 추출해 반환 | ||
*/ | ||
public static String categoryFilter(String category) { | ||
if (category == null) { | ||
return Category.ETC.getDesc(); | ||
} else if (category.contains(">")) { | ||
return Category.giveCategory(category.split(" > ")[1]).getDesc(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
} |