简体   繁体   English

Pascal Case(或 Upper Camel Case),但允许使用 HTMLInputElement 之类的名称?

[英]Pascal Case (or Upper Camel Case) but allows name like HTMLInputElement?

I'm trying to find a definition of a "casing standard" that allows two capitalized letters to follow directly after each other.我试图找到一个“大小写标准”的定义,它允许两个大写字母直接紧随其后。 An example of this is HTMLInputElement that seemingly defies the rules.这方面的一个例子是看似违反规则的 HTMLInputElement。 I prefer this, even though it breaks the strict naming rules, which would require it to be HtmlInputElement instead.我更喜欢这个,即使它违反了严格的命名规则,这将要求它改为 HtmlInputElement。 Does anyone know if there's an official name for this casing subset because I don't think it adheres to either of these standards... but perhaps this is also one of the differences between Pascal Case and Upper Camel Case and it hasn't been defined well enough in the existing definitions I've found online?有谁知道这个套管子集是否有官方名称,因为我认为它不符合这两个标准中的任何一个……但也许这也是 Pascal Case 和 Upper Camel Case 之间的区别之一,而且还没有在我在网上找到的现有定义中定义得足够好?

I'm not sure if that casing standard exists, I think it's just an exception in camel case when there is an abbreviated term like HTML.我不确定该套管标准是否存在,我认为这只是骆驼案例中的一个例外,当有一个缩写词如 HTML 时。

Here's another version of the question: Acronyms in CamelCase这是问题的另一个版本: CamelCase 中的首字母缩略词

Apparently Microsoft guidelines state (according to this article ):显然微软指南 state (根据这篇文章):

When using acronyms, use Pascal case or camel case for acronyms more than two characters long.使用首字母缩略词时,对于长度超过两个字符的首字母缩略词,请使用 Pascal 大小写或驼峰大小写。 For example, use HtmlButton or htmlButton.例如,使用 HtmlButton 或 htmlButton。 However, you should capitalize acronyms that consist of only two characters, such as System.IO instead of System.Io.但是,您应该将仅包含两个字符的首字母缩写词大写,例如 System.IO 而不是 System.Io。

Do not use abbreviations in identifiers or parameter names.不要在标识符或参数名称中使用缩写。 If you must use abbreviations, use camel case for abbreviations that consist of more than two characters, even if this contradicts the standard abbreviation of the word.如果您必须使用缩写,对包含两个以上字符的缩写使用驼峰式大小写,即使这与单词的标准缩写相矛盾。

Although pretty debated, I'm not sure there is a perfectly correct answer to your question.尽管争论不休,但我不确定您的问题是否有完全正确的答案。 Lots of this is based to opinion and interpretation.这很多都是基于意见和解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM