本文翻譯自: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樓
我只是說這是連字號 。