aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/laria
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-10-01 23:04:30 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-10-01 23:04:30 +0200
commit1d07f7ba44163364b22521056e7ff774fc1b1185 (patch)
tree2b11c7d57ee5c056c285735ec66827876fcaef70 /src/main/java/me/laria
parent446ee379019b16c32b1ba055e3afb113a013d0b6 (diff)
downloadidea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.tar.gz
idea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.tar.bz2
idea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.zip
Add "Sentence case" conversionv.0.6.2
Diffstat (limited to 'src/main/java/me/laria')
-rw-r--r--src/main/java/me/laria/code/idea_caseconv/SentenceCaseAction.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/me/laria/code/idea_caseconv/SentenceCaseAction.java b/src/main/java/me/laria/code/idea_caseconv/SentenceCaseAction.java
new file mode 100644
index 0000000..8dace53
--- /dev/null
+++ b/src/main/java/me/laria/code/idea_caseconv/SentenceCaseAction.java
@@ -0,0 +1,17 @@
+package me.laria.code.idea_caseconv;
+
+import java.util.Optional;
+
+public class SentenceCaseAction extends SelectionReplacerAction {
+ @Override
+ protected String replace(String s) {
+ return WordSplitConverter.convert(
+ s,
+ " ",
+ (i, part) -> Optional.of(i == 0 ?
+ CamelCaseAction.ucfirst(part)
+ : part
+ )
+ );
+ }
+}