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
4
votes
4 answers

How do I enhance slugify to handle Camel Case?

I'd like to write a JavaScript function to slugify a string, with one more requirement: handle Camel Case. For example, thisIsCamelCase would become this-is-camel-case. How do I modify a function like this to do so? EDIT Added full, answered…
Matt Norris
  • 8,596
  • 14
  • 59
  • 90
4
votes
4 answers

Convert hyphen delimited string to camelCase?

For example: abc-def-xyz to abcDefXyz the-fooo to theFooo etc. What's the most efficient way to do this PHP? Here's my take: $parts = explode('-', $string); $new_string = ''; foreach($parts as $part) $new_string .= ucfirst($part); $new_string =…
Alex
  • 66,732
  • 177
  • 439
  • 641
4
votes
1 answer

RegEx and split camelCase

I want to get an array of all the words with capital letters that are included in the string. But only if the line begins with "set". For example: - string "setUserId", result array("User", "Id") - string "getUserId", result false Without…
Tui Kiken
  • 205
  • 2
  • 8
4
votes
3 answers

Doctrine 2 ORM creates classes with hateful CamelCase

I created yaml configuration for Doctrine. When I'm trying doctrine orm:generate-entities, it creates php files with getters and setters in camel case. So, is_public field transforms into setIsPublic and getIsPublic methods. It's owful. How can I…
Pavel Strakhov
  • 39,123
  • 5
  • 88
  • 127
4
votes
0 answers

Where to use camelCase in Python according to PEP 8?

Recently I have started working on machine learning with Python, however I'm very new to this language. I know that "Readability counts", so I have been trying to get myself familiar with the PEP 8 coding conventions. I know where to…
tamuno
  • 103
  • 1
  • 11
4
votes
3 answers

How does one break a string down by capital letters with PHP?

I have a string: CamelCaseString I want to explode(), split(), or some better method on capital letters to break this string down into the individual words. What's the simplest way to do this? --- SOLUTION UPDATE --- This link is to a slightly…
T. Brian Jones
  • 13,002
  • 25
  • 78
  • 117
4
votes
1 answer

Utf8 correct regex for CamelCase (WikiWord) in perl

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…
clt60
  • 62,119
  • 17
  • 107
  • 194
4
votes
2 answers

Entity Framework database-first approach Pascal case

I am using EF Core 3.0 with a database-first approach to Scaffold-DbContext from a SQL Server database: dotnet ef dbcontext scaffold "Server=***;Database=***;User Id=***;Password=****;" Microsoft.EntityFrameworkCore.SqlServer -o…
4
votes
1 answer

Configure class and member name casing (lowerCamelCase vs. UpperCamelCase) for "Paste JSON as Classes" in Visual Studio

Consider this JSON: { "firstName": "John", "lastName": "Doe", "homeAddress": { "streetAddress": "123 Main St", "city": "Boston", "state": "MA", "postalCode": "02110" }, "employmentInfo": { …
rory.ap
  • 34,009
  • 10
  • 83
  • 174
4
votes
1 answer

Convert JSON camel case to snake case (and vice versa) and stringify numeric values

I have to send and receive JSON objects to a web REST service. The objects are produced by a DLL that serializes the attribute names in upper camel case ("PropertyName"), and the web service wants snake case ("property_name"). Plus, the DLL…
davidthegrey
  • 1,205
  • 2
  • 14
  • 23
4
votes
3 answers

ASP.NET Core MVC dynamic return is not camelCased

Return a strongly typed object from your service, and it renders JSON properties as camelCase, because that's the default in ASP.NET Core MVC. However, sometimes we need to create something on the fly using dynamic keyword and ExpandoObject…
4
votes
2 answers

Uppercase or lowercase confusion at the end of the acronyms in Coding Convention

For example; I have a function named that; int ReadEncoderSpeedRPM_ ( int channel ); I want to divide it into left and right. But short of Revolutions Per Minute at the end, restricts me from that kind of renaming; int ReadEncoderSpeedRPML_…
4
votes
2 answers

rails attribute names camelcase issue

I have legacy Sql Server database and Rails applications. Column names in database are all in PascalCase (FirstName, CustomerId...). I'm searching for an easy way to use underscore_casing in Ruby and PascalCasing in database. I would like to write…
4
votes
4 answers

Regular rxpression to convert a camel case string into kebab case

function hyphenate(str) { var replace = "-"; str = str.toLowerCase().replace(/[\s_\b]/g, replace); console.log(str); return str; } hyphenate("This Is Hyphenate"); // this-is-hyphenate hyphenate("camelCaseString"); //…
brndng
  • 103
  • 1
  • 7
4
votes
4 answers

Python: Change uppercase letter

I can't figure out how to replace the second uppercase letter in a string in python. for example: string = "YannickMorin" I want it to become yannick-morin As of now I can make it all lowercase by doing string.lower() but how to put a dash when it…
Yannick
  • 3,553
  • 9
  • 43
  • 60