summaryrefslogtreecommitdiff
path: root/lib/bluetooth/utils.vala
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-09-01 14:17:36 +0200
committerAylur <[email protected]>2024-09-01 14:17:36 +0200
commit3e3f045d650a839d21f7b649da7aa5c19bd2e38b (patch)
tree9a974eb0d38932d474940288c662bd1f01ea3088 /lib/bluetooth/utils.vala
parent408faee16911ccfaa3e7dad69f9938fd4a696704 (diff)
monorepo structuring
Diffstat (limited to 'lib/bluetooth/utils.vala')
-rw-r--r--lib/bluetooth/utils.vala21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bluetooth/utils.vala b/lib/bluetooth/utils.vala
new file mode 100644
index 0000000..5dcaff6
--- /dev/null
+++ b/lib/bluetooth/utils.vala
@@ -0,0 +1,21 @@
+namespace AstalBluetooth {
+internal string kebab_case(string pascal_case) {
+ StringBuilder kebab_case = new StringBuilder();
+
+ for (int i = 0; i < pascal_case.length; i++) {
+ char c = pascal_case[i];
+
+ if (c >= 'A' && c <= 'Z') {
+ if (i != 0) {
+ kebab_case.append_c('-');
+ }
+
+ kebab_case.append_c((char)(c + 32));
+ } else {
+ kebab_case.append_c(c);
+ }
+ }
+
+ return kebab_case.str;
+}
+}