aboutsummaryrefslogtreecommitdiff
path: root/src/string_utils.rs
diff options
context:
space:
mode:
author1992414357@qq.com <1992414357@qq.com>2025-06-09 01:44:36 +0800
committer1992414357@qq.com <1992414357@qq.com>2025-06-09 01:44:36 +0800
commit49192dbb98e0ab1f2a66b4786fac86d63f69be64 (patch)
tree7cdf27c7cab5fb6b1aabc2ac7c44b7b492558945 /src/string_utils.rs
parentc9dbba0d288becb7f05cebe526be25c76e5a850a (diff)
重构所有部分
Diffstat (limited to 'src/string_utils.rs')
-rw-r--r--src/string_utils.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/string_utils.rs b/src/string_utils.rs
new file mode 100644
index 0000000..7a02f25
--- /dev/null
+++ b/src/string_utils.rs
@@ -0,0 +1,16 @@
+pub fn process_id_text(input: String) -> String {
+ let s = input.trim().to_lowercase();
+ let mut result = String::new();
+
+ for c in s.chars() {
+ match c {
+ '\n' | '_' => continue,
+ '-' | '.' | ',' | ' ' => result.push('_'),
+ _ => result.push(c),
+ }
+ }
+
+ result.chars()
+ .filter(|&c| c.is_ascii_alphanumeric() || c == '_')
+ .collect()
+} \ No newline at end of file