diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-10-01 23:04:30 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-10-01 23:04:30 +0200 |
commit | 1d07f7ba44163364b22521056e7ff774fc1b1185 (patch) | |
tree | 2b11c7d57ee5c056c285735ec66827876fcaef70 /src | |
parent | 446ee379019b16c32b1ba055e3afb113a013d0b6 (diff) | |
download | idea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.tar.gz idea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.tar.bz2 idea_caseconv-1d07f7ba44163364b22521056e7ff774fc1b1185.zip |
Add "Sentence case" conversionv.0.6.2
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/me/laria/code/idea_caseconv/SentenceCaseAction.java | 17 | ||||
-rw-r--r-- | src/main/resources/META-INF/plugin.xml | 9 |
2 files changed, 25 insertions, 1 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 + ) + ); + } +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 8711a15..84a690e 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ <idea-plugin> <id>me.laria.code.idea_caseconv</id> <name>Case conversion</name> - <version>0.6.1</version> + <version>0.6.2</version> <vendor email="laria@laria.me" url="https://code.laria.me">Laria Chabowski</vendor> <description><![CDATA[<html> @@ -17,6 +17,7 @@ <li>lower case</li> <li>fLIP cASE</li> <li>Title Case</li> + <li>Sentence case</li> <li>dot.case</li> </ul> <p>How to use:</p> @@ -30,6 +31,9 @@ <change-notes><![CDATA[<html> <dl> + <dt>Version 0.6.2</dt> + <dd>Add <code>Convert case: Sentence case</code> action</dd> + <dt>Version 0.6.1</dt> <dd>Add a short documentation on how to use the plugin</dd> @@ -86,6 +90,9 @@ <action id="me.laria.code.idea_caseconv.TitleCaseAction" class="me.laria.code.idea_caseconv.TitleCaseAction" text="Convert Case: Title Case"> </action> + <action id="me.laria.code.idea_caseconv.SentenceCaseAction" class="me.laria.code.idea_caseconv.SentenceCaseAction" + text="Convert Case: Sentence case"> + </action> <action id="me.laria.code.idea_caseconv.DotCaseAction" class="me.laria.code.idea_caseconv.DotCaseAction" text="Convert Case: dot.case"> </action> |