Questions tagged [camelcasing]

Camel case is a language-independent naming convention in which an identifier name will start with a lowercase letter and each additional word within the name will start uppercase, such as customerName, printInvoice, etc.

403 questions
76
votes
3 answers

Underscores or camelCase in PostgreSQL identifiers, when the programming language uses camelCase?

Given an OO language in which the naming convention for object properties is camelCased, and an example object like this: { id: 667, firstName: "Vladimir", lastName: "Horowitz", canPlayPiano: true } How should I model this structure…
Zilk
  • 8,917
  • 7
  • 36
  • 44
74
votes
9 answers

Disable check of camel case rule in eslint

I have a large JavaScript file with multiple eslint rule violations. I am trying to disable them and address them one at a time. The code below shows that I can disable them all with no trouble, but not the rule about camelcase and perhaps other…
JimFuqua
  • 961
  • 1
  • 7
  • 12
56
votes
5 answers

Javascript/jQuery: Split camelcase string and add hyphen rather than space

I would imagine this is a multiple part situation with regex, but how would you split a camelcase string at the capital letters turning them in to lowercase letters, and then adding a hyphen between each new string? For example: thisString would…
user1048007
  • 581
  • 1
  • 4
  • 4
50
votes
9 answers

Regex for PascalCased words (aka camelCased with leading uppercase letter)

How do I find all PascalCased words in a document with a regular expression? If you don't know the word Pascal cased, I'm only concerned with leading Upper camel case (i.e., camel cased words in which the first letter is capitalized).
Tom Lehman
  • 85,973
  • 71
  • 200
  • 272
46
votes
4 answers

Can I use camelCase in CSS class names

I want to name a CSS class and call it imgSuper. Can I use camelCasing in CSS classes?
KJai
  • 1,655
  • 3
  • 15
  • 16
40
votes
5 answers

Naming convention for upper case abbreviations

Should a method that returns an XML stream be called public Stream getXmlStream(); or instead public Stream getXMLStream(); What's your opinion about that? What's considered best practice?
user321068
39
votes
7 answers

Converting nested hash keys from CamelCase to snake_case in Ruby

I'm trying to build an API wrapper gem, and having issues with converting hash keys to a more Rubyish format from the JSON the API returns. The JSON contains multiple layers of nesting, both Hashes and Arrays. What I want to do is to recursively…
Andrew Stewart
  • 710
  • 1
  • 6
  • 10
39
votes
5 answers

Is there a way to enable camel humping through method names in VS Code?

As this question is for the "big" Visual Studio and Resharper, I'd like to see that feature in VS Code too. Scrolling through the shortcut list for VS Code, I couldn't find it but I'm hoping that it's still there but called something less intuitive…
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
37
votes
2 answers

MVC JsonResult camelCase serialization

I am trying to make my action return a JsonResult where all its properties are in camelCase. I have a simply model: public class MyModel { public int SomeInteger { get; set; } public string SomeString { get; set; } } And a simple…
Thomas Mondel
  • 1,944
  • 3
  • 20
  • 25
36
votes
8 answers

Default camel case of property names in JSON serialization

I have a bunch of classes that will be serialized to JSON at some point and for the sake of following both C# conventions on the back-end and JavaScript conventions on the front-end, I've been defining properties like…
Matt Burland
  • 44,552
  • 18
  • 99
  • 171
36
votes
6 answers

Acronyms in Camel Back

I often see Java class names like XmlReader instead of XMLReader My gut feeling is to completely upper case acronyms, but apparently many people think differently. Or maybe it's just because a lot of code generators are having trouble with…
Stroboskop
  • 4,327
  • 5
  • 35
  • 52
35
votes
4 answers

Force CamelCase on ASP.NET WebAPI Per Controller

In ASP.NET WebAPI, I know you can set the default json formatter to use camel case using CamelCasePropertyNamesContractResolver() in the global.aspx which will force ALL json serialization to camel case. However, I need to be able to set it on a…
Brad Bamford
  • 3,783
  • 3
  • 22
  • 30
35
votes
6 answers

Is using camelCase in CSS ids or classes ok or not?

Question is in the title. I'm used to using camelcase in development and, since there are crossovers with design, was wondering if there are any technical reasons (regardless of opinions) against using it in HTML. Thanks in advance for your replies.
James P.
  • 19,313
  • 27
  • 97
  • 155
34
votes
7 answers

Converting from camelcase to _ in emacs

Is there an emacs function to convert a camel-cased word to underscore? Something, like: longVariableName M-x to-underscore long_variable_name
David Nehme
  • 21,379
  • 8
  • 78
  • 117
34
votes
13 answers

Separating CamelCase string into space-separated words in Swift

I would like to separate a CamelCase string into space-separated words in a new string. Here is what I have so far: var camelCaps: String { guard self.count > 0 else { return self } var newString: String = "" let uppercase =…
Brian Arnold
  • 353
  • 1
  • 4
  • 10
1
2
3
26 27