File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
src/main/java/com/crzsc/plugin/utils Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.crzsc.plugin.utils
22
33import com.crzsc.plugin.utils.PluginUtils.showNotify
44import com.crzsc.plugin.utils.PluginUtils.toLowCamelCase
5- import com.crzsc.plugin.utils.PluginUtils.toUpperCaseFirst
5+ import com.crzsc.plugin.utils.PluginUtils.upperCaseFirst
66import com.intellij.openapi.application.ApplicationManager
77import com.intellij.openapi.command.WriteCommandAction
88import com.intellij.openapi.project.Project
@@ -140,9 +140,9 @@ class FileGenerator(private val project: Project) {
140140 val value = it.path.removePrefix(" $basePath /" )
141141 if (namedWithParent) {
142142 it.parent?.let { parent ->
143- key = " ${parent.name.toLowCamelCase(regex)}${key.toUpperCaseFirst ()} "
143+ key = " ${parent.name.toLowCamelCase(regex)}${key.upperCaseFirst ()} "
144144 if (map.containsKey(key)) {
145- key = " ${parent.parent.name.toLowCamelCase(regex)}${key.toUpperCaseFirst ()} "
145+ key = " ${parent.parent.name.toLowCamelCase(regex)}${key.upperCaseFirst ()} "
146146 }
147147 map[key] = value
148148 }
Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ object PluginUtils {
4242 val sb = StringBuilder ()
4343 for (i in split.indices) {
4444 if (i == 0 ) {
45- sb.append(split[i])
45+ sb.append(split[i].lowerCaseFirst() )
4646 } else {
47- sb.append(split[i].toUpperCaseFirst ())
47+ sb.append(split[i].upperCaseFirst ())
4848 }
4949 }
5050 return sb.toString()
@@ -59,14 +59,22 @@ object PluginUtils {
5959 .openTextEditor(OpenFileDescriptor (project, vFile), true )
6060 }
6161
62+ fun String.lowerCaseFirst (): String {
63+ return if (this .isEmpty()) {
64+ this
65+ } else {
66+ " ${this [0 ].lowercase()}${this .subSequence(1 , this .length)} "
67+ }
68+ }
69+
6270 /* *
6371 * 首字母大写
6472 */
65- fun String.toUpperCaseFirst (): String {
73+ fun String.upperCaseFirst (): String {
6674 return if (this .isEmpty()) {
6775 this
6876 } else {
69- " ${this [0 ].toUpperCase ()}${this .subSequence(1 , this .length)} "
77+ " ${this [0 ].uppercase ()}${this .subSequence(1 , this .length)} "
7078 }
7179 }
7280}
You can’t perform that action at this time.
0 commit comments