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
1049
votes
15 answers

What is the naming convention in Python for variables and functions?

Coming from a C# background the naming convention for variables and methods are usually either camelCase or PascalCase: // C# example string thisIsMyVariable = "a" public void ThisIsMyMethod() In Python, I have seen the above but I have also seen…
Ray
  • 187,153
  • 97
  • 222
  • 204
605
votes
7 answers

JSON Naming Convention (snake_case, camelCase or PascalCase)

Is there a standard on JSON naming?I see most examples using all lower case separated by underscore, aka snake_case, but can it be used PascalCase or camelCase as well?
GeorgeU
  • 7,819
  • 8
  • 26
  • 38
355
votes
11 answers

Acronyms in CamelCase

I have a doubt about CamelCase. Suppose you have this acronym: Unesco = United Nations Educational, Scientific and Cultural Organization. You should write: unitedNationsEducationalScientificAndCulturalOrganization But what if you need to write the…
gal007
  • 6,911
  • 8
  • 47
  • 70
332
votes
30 answers

Elegant Python function to convert CamelCase to snake_case?

Example: >>> convert('CamelCase') 'camel_case'
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
315
votes
14 answers

How can I return camelCase JSON serialized by JSON.NET from ASP.NET MVC controller methods?

My problem is that I wish to return camelCased (as opposed to the standard PascalCase) JSON data via ActionResults from ASP.NET MVC controller methods, serialized by JSON.NET. As an example consider the following C# class: public class Person { …
aknuds1
  • 65,625
  • 67
  • 195
  • 317
291
votes
44 answers

Converting any string into camel case

How can I convert a string into camel case using javascript regex? EquipmentClass name or Equipment className or equipment class name or Equipment Class Name should all become: equipmentClassName.
Scott Klarenbach
  • 37,171
  • 15
  • 62
  • 91
267
votes
3 answers

How to navigate through the source code by parts in CamelCase (instead of whole words)?

I remember when I was using Eclipse that when holding CTRL and using left or right arrows Eclipse would navigate over the LongCamelCaseWrittenWord in several steps. One camel case word at time. So it will go like follows (pipe | represents the…
Jan Zyka
  • 17,460
  • 16
  • 70
  • 118
168
votes
16 answers

Convert hyphens to camel case (camelCase)

With regex (i assume) or some other method, how can i convert things like: marker-image or my-example-setting to markerImage or myExampleSetting. I was thinking about just splitting by - then convert the index of that hypen +1 to uppercase. But it…
Oscar Godson
  • 31,662
  • 41
  • 121
  • 201
133
votes
4 answers

Convert JSON style properties names to Java CamelCase names with GSON

I'm using GSON to convert JSON data I get to a Java object. It works pretty well in all my tests. The problem is that our real objects have some properties named like is_online. GSON only maps them if they are named totally equal, it would be nice…
Janusz
  • 187,060
  • 113
  • 301
  • 369
130
votes
6 answers

What are the different kinds of cases?

I'm interested in the different kinds of identifier cases, and what people call them. Do you know of any additions to this list, or other alternative names? myIdentifier : Camel case (e.g. in java variable names) MyIdentifier : Capital camel case…
Austin Cory Bart
  • 2,159
  • 2
  • 19
  • 32
122
votes
6 answers

Should Python class filenames also be camelCased?

I know that classes in Python are typically cased using camelCase. Is it also the normal convention to have the file that contains the class also be camelCase'd especially if the file only contains the class? For example, should class className also…
m4jesticsun
  • 1,799
  • 3
  • 12
  • 12
104
votes
19 answers

Convert String To camelCase from TitleCase C#

I have a string that I converted to a TextInfo.ToTitleCase and removed the underscores and joined the string together. Now I need to change the first and only the first character in the string to lower case and for some reason, I can not figure out…
Gabriel_W
  • 1,645
  • 5
  • 16
  • 26
94
votes
11 answers

RegEx to split camelCase or TitleCase (advanced)

I found a brilliant RegEx to extract the part of a camelCase or TitleCase expression. (? value camelValue -> camel / Value TitleValue -> Title / Value For example with Java: String s =…
Jmini
  • 9,189
  • 2
  • 55
  • 77
91
votes
4 answers

Why True/False is capitalized in Python?

All members are camel case, right? Why True/False but not true/false, which is more relaxed?
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
76
votes
16 answers

How to do CamelCase split in python

What I was trying to achieve, was something like this: >>> camel_case_split("CamelCaseXYZ") ['Camel', 'Case', 'XYZ'] >>> camel_case_split("XYZCamelCase") ['XYZ', 'Camel', 'Case'] So I searched and found this perfect regular…
AplusKminus
  • 1,542
  • 1
  • 19
  • 32
1
2 3
26 27