Compare commits
No commits in common. "280ccd77dd8325ddcece0a5dfe58d8e8df130045" and "b87dbf128de8d87307d2d045e639b9bc279bb351" have entirely different histories.
280ccd77dd
...
b87dbf128d
2 changed files with 8 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "schmfy"
|
||||
version = "0.2.2"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Schmfication library"
|
||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -116,15 +116,17 @@ pub fn schmfy(source: &str) -> String {
|
|||
|
||||
// schmfy first char if word is no longer than 3
|
||||
if source.len() <= 3 && case != CaseType::FstUcase {
|
||||
let first_c_size = source.chars().next().unwrap().len_utf8();
|
||||
let (prefix, suffix) = source.split_at(first_c_size);
|
||||
let (prefix, suffix) = source.split_at(1);
|
||||
let c = prefix.chars().next().unwrap_or('-');
|
||||
return restore_case(schmfy_char(c) + suffix, case);
|
||||
}
|
||||
|
||||
// Normal words - replace prefix before first vocal
|
||||
// with "schm"
|
||||
let vok_pos = source.find(|c| "aeiouäöü".contains(c)).unwrap_or(0);
|
||||
let vok_pos = source
|
||||
.chars()
|
||||
.position(|c| "aeiouäöü".contains(c))
|
||||
.unwrap_or(0);
|
||||
|
||||
let (_, suffix) = source.split_at(vok_pos);
|
||||
|
||||
|
@ -243,9 +245,8 @@ This is a Markdown codebox
|
|||
| This | is |
|
||||
|---|---|
|
||||
| a | Markdown |
|
||||
| table | ! |"
|
||||
),
|
||||
"
|
||||
| table | ! |"),
|
||||
"
|
||||
```
|
||||
Schmis schmis schma Schmarkdown schmodebox
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue