相关疑难解决方法(0)

缩略语CamelCase

我对CamelCase有疑问.你有这个缩写:Unesco = United Nations Educational, Scientific and Cultural Organization.

你应该写: unitedNationsEducationalScientificAndCulturalOrganization

但是如果你需要写首字母缩略词怎么办?就像是:

getUnescoProperties();
Run Code Online (Sandbox Code Playgroud)

用这种方式写它是对的吗? getUnescoProperties() OR getUNESCOProperties();

camelcasing coding-style acronym

226
推荐指数
7
解决办法
6万
查看次数

在Capital Letter之前添加空格

给定字符串"ThisStringHasNoSpacesButItDoesHaveCapitals",在大写字母之前添加空格的最佳方法是什么.所以结束字符串将是"这个字符串没有空格,但它有资本"

以下是我使用RegEx的尝试

System.Text.RegularExpressions.Regex.Replace(value, "[A-Z]", " $0")
Run Code Online (Sandbox Code Playgroud)

c# regex string

185
推荐指数
7
解决办法
7万
查看次数

在驼峰标记上的单词之间插入空格

是否有一个很好的功能来转变类似的东西

名字

对此:

名字?

c#

96
推荐指数
4
解决办法
5万
查看次数

检查java中的命名约定

通过java反射如何检查方法名是否在camelCase中?例如

import java.lang.reflect.*;

   public class TestClass {
      private int simpleMethod(
       Object p, int x) throws NullPointerException
      {
         if (p == null)
            throw new NullPointerException();
         return x;
      }

      public static void main(String args[])
      {
         try {
           Class cls = Class.forName("method1");

            Method methlist[] 
              = cls.getDeclaredMethods();
            for (int i = 0; i < methlist.length;
               i++) {  
               Method m = methlist[i];
               System.out.println("name= " + m.getName());

            }
         }
         catch (Throwable e) {
            System.err.println(e);
         }
      }
   }
Run Code Online (Sandbox Code Playgroud)

这里我得到方法名称simpleMethod和main我必须检查这些名称是否在camelCase中.

java reflection

1
推荐指数
1
解决办法
2357
查看次数

标签 统计

c# ×2

acronym ×1

camelcasing ×1

coding-style ×1

java ×1

reflection ×1

regex ×1

string ×1