Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-core/src/case_conversion.rs')
-rw-r--r--helix-core/src/case_conversion.rs69
1 files changed, 0 insertions, 69 deletions
diff --git a/helix-core/src/case_conversion.rs b/helix-core/src/case_conversion.rs
deleted file mode 100644
index 2054a2bb..00000000
--- a/helix-core/src/case_conversion.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-use crate::Tendril;
-
-// todo: should this be grapheme aware?
-
-pub fn to_pascal_case(text: impl Iterator<Item = char>) -> Tendril {
- let mut res = Tendril::new();
- to_pascal_case_with(text, &mut res);
- res
-}
-
-pub fn to_pascal_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) {
- let mut at_word_start = true;
- for c in text {
- // we don't count _ as a word char here so case conversions work well
- if !c.is_alphanumeric() {
- at_word_start = true;
- continue;
- }
- if at_word_start {
- at_word_start = false;
- buf.extend(c.to_uppercase());
- } else {
- buf.push(c)
- }
- }
-}
-
-pub fn to_upper_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) {
- for c in text {
- for c in c.to_uppercase() {
- buf.push(c)
- }
- }
-}
-
-pub fn to_lower_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) {
- for c in text {
- for c in c.to_lowercase() {
- buf.push(c)
- }
- }
-}
-
-pub fn to_camel_case(text: impl Iterator<Item = char>) -> Tendril {
- let mut res = Tendril::new();
- to_camel_case_with(text, &mut res);
- res
-}
-pub fn to_camel_case_with(mut text: impl Iterator<Item = char>, buf: &mut Tendril) {
- for c in &mut text {
- if c.is_alphanumeric() {
- buf.extend(c.to_lowercase())
- }
- }
- let mut at_word_start = false;
- for c in text {
- // we don't count _ as a word char here so case conversions work well
- if !c.is_alphanumeric() {
- at_word_start = true;
- continue;
- }
- if at_word_start {
- at_word_start = false;
- buf.extend(c.to_uppercase());
- } else {
- buf.push(c)
- }
- }
-}