リビジョン | 63f092093109e2672ac7953461367dc721d1609b (tree) |
---|---|
日時 | 2024-11-20 23:55:56 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
コミッター | Lorenzo Isella |
I added another function for string analysis.
@@ -7874,3 +7874,15 @@ | ||
7874 | 7874 | ## # Use a different separator |
7875 | 7875 | ## custom_string <- "A, B, C, D" |
7876 | 7876 | ## extract_first_n_chars(custom_string, separator = ",") |
7877 | + | |
7878 | + | |
7879 | + | |
7880 | +count_non_pattern_chars <- function(input_string, pattern) { | |
7881 | + # Remove all characters matching the pattern and count the length of the remaining string | |
7882 | + non_pattern_count <- str_length(str_replace_all(input_string, pattern, "")) | |
7883 | + return(non_pattern_count) | |
7884 | +} | |
7885 | + | |
7886 | + | |
7887 | + | |
7888 | + |