-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #293 from YuukiToriyama/feature/fix-bug-268/master
郡名と町名が一致している場合をrelease/v0.1.3-rc.1にマージ
- Loading branch information
Showing
7 changed files
with
225 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod converter; | ||
pub mod sequence_matcher; | ||
mod trimmer; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
pub fn trim_city_name(input: &str) -> String { | ||
match input.chars().position(|c| c == '郡' || c == '市') { | ||
Some(position) => input.chars().skip(position + 1).collect::<String>(), | ||
None => input.to_string(), | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::util::trimmer::trim_city_name; | ||
|
||
#[test] | ||
fn trim_city_name_成功() { | ||
assert_eq!(trim_city_name("南会津郡下郷町"), "下郷町"); | ||
assert_eq!(trim_city_name("南会津郡只見町"), "只見町"); | ||
assert_eq!(trim_city_name("白河市新白河一丁目"), "新白河一丁目"); | ||
} | ||
} |
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
Oops, something went wrong.