abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/StringUtils.java
diff options
context:
space:
mode:
authorJules Aguillon2023-09-09 14:32:03 +0200
committerJules Aguillon2023-09-09 14:32:03 +0200
commit44e2e86f19bd9e7acddad50506dad0737fa032d9 (patch)
treebca7fd0aeea1f49316e0f5326b3b2673bdf48509 /srcs/juloo.keyboard2/StringUtils.java
parent92a8db5e9374082000f9c79becd09661bea84dd9 (diff)
downloadunexpected-keyboard-44e2e86f19bd9e7acddad50506dad0737fa032d9.tar.gz
unexpected-keyboard-44e2e86f19bd9e7acddad50506dad0737fa032d9.zip
Capitalize the first letter of custom keys
This is more useful than turning the entire string full caps.
Diffstat (limited to 'srcs/juloo.keyboard2/StringUtils.java')
-rw-r--r--srcs/juloo.keyboard2/StringUtils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/StringUtils.java b/srcs/juloo.keyboard2/StringUtils.java
new file mode 100644
index 0000000..2994509
--- /dev/null
+++ b/srcs/juloo.keyboard2/StringUtils.java
@@ -0,0 +1,12 @@
+package juloo.keyboard2;
+
+final class Utils
+{
+ /** Turn the first letter of a string uppercase. */
+ public static String capitalize_string(String s)
+ {
+ // Make sure not to cut a code point in half
+ int i = s.offsetByCodePoints(0, 1);
+ return s.substring(0, i).toUpperCase() + s.substring(i);
+ }
+}