本文翻译自:What's the name for hyphen-separated case? [closed]
This is PascalCase: SomeSymbol
这是PascalCase: SomeSymbol
This is camelCase: someSymbol
这是someSymbol
: someSymbol
This is snake_case: some_symbol
这是snake_case: some_symbol
So my questions is whether there is a widely accepted name for this: some-symbol
? 所以我的问题是,是否有一个广泛接受的名称: some-symbol
? It's commonly used in url's. 通常在url中使用。
#1楼
参考:https://stackoom.com/question/lIh8/连字符分隔的大小写是什么-关闭
#2楼
It's referred to as kebab-case . 这被称为kebab-case 。 See lodash docs . 请参阅lodash docs 。
#3楼
There isn't really a standard name for this case convention, and there is disagreement over what it should be called. 这种情况下的约定实际上并没有一个标准名称,因此应如何称呼也存在分歧。
That said, as of 2019, there is a strong case to be made that kebab-case is winning: 就是说,从2019年开始,有充分的理由证明烤肉串案例会获胜:
https://trends.google.com/trends/explore?date=all&q=kebab-case,spinal-case,lisp-case,dash-case,caterpillar-case https://trends.google.com/trends/explore?date=all&q=kebab-case,spinal-case,lisp-case,dash-case,caterpillar-case
spinal-case is a distant second, and no other terms have any traction at all. 脊柱情况是遥不可及的,其他术语根本没有任何吸引力。
Additionally, kebab-case has entered the lexicon of several javascript code libraries, eg: 另外, kebab-case已进入几个javascript代码库的词典,例如:
- https://lodash.com/docs/#kebabCase https://lodash.com/docs/#kebabCase
- https://www.npmjs.com/package/kebab-case https://www.npmjs.com/package/kebab-case
- https://vuejs.org/v2/guide/components-props.html#Prop-Casing-camelCase-vs-kebab-case https://vuejs.org/v2/guide/components-props.html#Prop-Casing-camelCase-vs-kebab-case
However, there are still other terms that people use. 但是,人们仍然使用其他术语。 Lisp has used this convention for decades as described in this Wikipedia entry , so some people have described it as lisp-case . Lisp在此Wikipedia条目中已经描述了数十年的惯例,因此有人将其描述为lisp-case 。 Some other forms I've seen include caterpillar-case , dash-case , and hyphen-case , but none of these is standard. 我见过的其他一些形式包括caterpillar-case , dash-case和hyphen-case ,但是这些都不是标准的。
So the answer to your question is: No, there isn't a single widely-accepted name for this case convention analogous to snake_case or camelCase , which are widely-accepted. 因此,您的问题的答案是:不,这种情况下的约定没有一个与snake_case或camelCase类似的被广泛接受的名称。
#4楼
有时也称为毛毛虫箱
#5楼
Adding the correct link here Kebab Case 在此处添加正确的链接Kebab Case
which is All lowercase with - separating words. 全部为小写字母-分隔单词。
#6楼
我只是说这是连字号 。