camelcasing

What are the different kinds of cases?

纵然是瞬间 提交于 2019-12-02 17:01:24
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 (e.g. in java class names) my_identifier : Snake case (e.g. in python variable names) my-identifier : Kebab case (e.g. in racket names) myidentifier : Flat case (e.g. in java package names) MY_IDENTIFIER : Upper case (e.g. in C constant names) Nils von Barth Names are either generic, after a language, or colorful; most don’t have a standard name

Utf8 correct regex for CamelCase (WikiWord) in perl

匆匆过客 提交于 2019-12-01 18:49:08
Here was a question about the CamelCase regex . With the combination of tchrist post i'm wondering what is the correct utf-8 CamelCase . Starting with (brian d foy's) regex: / \b # start at word boundary [A-Z] # start with upper [a-zA-Z]* # followed by any alpha (?: # non-capturing grouping for alternation precedence [a-z][a-zA-Z]*[A-Z] # next bit is lower, any zero or more, ending with upper | # or [A-Z][a-zA-Z]*[a-z] # next bit is upper, any zero or more, ending with lower ) [a-zA-Z]* # anything that's left \b # end at word /x and modifying to: / \b # start at word boundary \p{Uppercase

Naming local constants: UpperCamelCase or lowerCamelCase?

早过忘川 提交于 2019-12-01 06:51:31
Which naming convention do you use for local constants in C# and why? const int Pi = 3; const int pi = 3; It seems the trade-off is between lower camel-case indicating restricted scope, and upper camel-case being more readable and easier to move to a class level. I've noticed StyleCop prefers upper camel-case. I'm used to upper case (pascal case) for everything except variables and fields. Global constants are an exception to the fields, I don't know why, probably because they are public in some cases. Local constants are also lowercase so. It's just a matter of taste imo. Of course, within a

Naming local constants: UpperCamelCase or lowerCamelCase?

荒凉一梦 提交于 2019-12-01 04:55:29
问题 Which naming convention do you use for local constants in C# and why? const int Pi = 3; const int pi = 3; It seems the trade-off is between lower camel-case indicating restricted scope, and upper camel-case being more readable and easier to move to a class level. I've noticed StyleCop prefers upper camel-case. 回答1: I'm used to upper case (pascal case) for everything except variables and fields. Global constants are an exception to the fields, I don't know why, probably because they are public

MySQL: Can't give tables a name in Upper Camel Case (Pascal Case)

倾然丶 夕夏残阳落幕 提交于 2019-11-30 23:15:29
I read that it is best practise to have table names in Pascal Case (ThisIsMyTableName). Therefor I would like to change my tables in MySQL. But neither phpmyadmin, nore SQL Manager 2005 for MySQL will let me. The names stay to appear in lowercase, as if I didn't to a change at all. Any suggestions to solve this problem? I advice against mixed case because of problems with case sensitivity. A fully tested solution on one platform where case doesn't matter may actually fail when deployed on a platform where case DOES matter. For that reason alone I suggest sticking with either all caps or all

camel case method names

为君一笑 提交于 2019-11-30 19:04:52
I understand the reason to camel case variable names, but I've always wondered why you would camel case a method name? why is it toString() and not ToString()? What purpose does it serve? A lot of conventions say you capitalize the first letter of types (classes, structs, enums, etc.), and use lowercase otherwise (functions, members, etc.). If you follow that convention, you can then tell just by looking that MyStruct.MyType refers to a nested type, and MyStruct.myData refers to some form of data, and MyStruct.myFunc() refers to a function call. We use lower-case on the first letter to save a

camelCase to dash - two capitals next to each other

拈花ヽ惹草 提交于 2019-11-30 18:31:06
I'm using this function to convert CamelCase to dashed string: function camel2dashed($className) { return strtolower(preg_replace('/([^A-Z-])([A-Z])/', '$1-$2', $className)); } it kinda works but theres problem when I have for ex. this string: getADog . It returns get-adog but I want get-a-dog how should I change my code? Thanks Use a lookahead assertion : function camel2dashed($className) { return strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $className)); } See it working online: ideone Ergwun You don't need a lookahead assertion to do this if you know that your string doesn't

MVC JsonResult camelCase serialization [duplicate]

心不动则不痛 提交于 2019-11-30 16:50:58
This question already has an answer here: Proper JSON serialization in MVC 4 3 answers 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 controller action: public JsonResult Index() { MyModel model = new MyModel(); model.SomeInteger = 1; model.SomeString = "SomeString"; return Json(model, JsonRequestBehavior.AllowGet); } Calling this action method now returns a JsonResult containing the following data: {"SomeInteger"

have jQuery ignore case in attribute/data names?

流过昼夜 提交于 2019-11-30 13:49:40
问题 We're using HTML5's data-* attributes for some of our client side interaction set up. jQuery uses these to do its thing. The catch is that the HTML coming in may vary. Obviously this is the problem that should be fixed but I'm not always in control of the HTML being produced, unfortunately. The question: Given these two tags: <a data-sampleAttributeName="example"> <a data-sampleattributename="example"> Is there a clever way to treat them as one and the same? The best I've come up with is

Splitting CamelCase in R

前提是你 提交于 2019-11-30 12:26:06
Is there a way to split camel case strings in R? I have attempted: string.to.split = "thisIsSomeCamelCase" unlist(strsplit(string.to.split, split="[A-Z]") ) # [1] "this" "s" "ome" "amel" "ase" 42- string.to.split = "thisIsSomeCamelCase" gsub("([A-Z])", " \\1", string.to.split) # [1] "this Is Some Camel Case" strsplit(gsub("([A-Z])", " \\1", string.to.split), " ") # [[1]] # [1] "this" "Is" "Some" "Camel" "Case" Looking at Ramnath's and mine I can say that my initial impression that this was an underspecified question has been supported. And give Tommy and Ramanth upvotes for pointing out [