From 88f205aab9167aeae720b657986bae5fe8b593e6 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Tue, 25 Jun 2019 21:55:46 +0200 Subject: Add Title Case action --- README.md | 3 ++- resources/META-INF/plugin.xml | 7 ++++++- src/me/laria/code/idea_caseconv/TitleCaseAction.java | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/me/laria/code/idea_caseconv/TitleCaseAction.java diff --git a/README.md b/README.md index d7cc58b..19dd6af 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,6 @@ The plugin provides actions to convert to these cases: - `UPPER CASE` - `lower case` - `fLIP cASE` +- `Title Case` -The Plugin was inspired by the [Case Conversion Plugin for SublimeText](https://packagecontrol.io/packages/Case%20Conversion). \ No newline at end of file +The Plugin was inspired by the [Case Conversion Plugin for SublimeText](https://packagecontrol.io/packages/Case%20Conversion). diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index c532213..9ab02a7 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ me.laria.code.idea_caseconv Case conversion - 0.5 + 0.5.1 Laria Chabowski @@ -16,6 +16,7 @@
  • UPPER CASE
  • lower case
  • fLIP cASE
  • +
  • Title Case
  • ]]>
    @@ -71,6 +72,10 @@ text="Convert Case: fLIP cASE"> + + +
    \ No newline at end of file diff --git a/src/me/laria/code/idea_caseconv/TitleCaseAction.java b/src/me/laria/code/idea_caseconv/TitleCaseAction.java new file mode 100644 index 0000000..70024c3 --- /dev/null +++ b/src/me/laria/code/idea_caseconv/TitleCaseAction.java @@ -0,0 +1,10 @@ +package me.laria.code.idea_caseconv; + +import java.util.Optional; + +public class TitleCaseAction extends SelectionReplacerAction { + @Override + protected String replace(String s) { + return WordSplitConverter.convert(s, " ", (i, part) -> Optional.of(CamelCaseAction.ucfirst(part))); + } +} -- cgit v1.2.3-54-g00ecf