23

I was wondering if you normally capitalise any letter in query strings, use dashes or underscores for variable names, or have any other query string naming convention. I cannot find any reference to it.

Edit: Since there seems to be no convention, are there any best practices or usual way to do it?

Badger Cat
  • 946
  • 2
  • 16
  • 31
  • 3
    There's no official W3C standard of which I'm aware, if that's what you mean. It's usually just a matter of personal/team preference. – David May 21 '12 at 14:05
  • Related question: https://stackoverflow.com/questions/10302179/hyphen-underscore-or-camelcase-as-word-delimiter-in-uris – Andrew Grimm Feb 20 '18 at 22:43

2 Answers2

24

I don't recall actually ever seeing people use dashes in parameter names in the query string. That probably shoots it down as best practice.

I would personally avoid camel case because I don't want to get into case sensitivity/insensitivity issues.

That leaves underscores, which I find is commonly used.

jgivoni
  • 1,605
  • 1
  • 15
  • 24
1

There is no convention in this case at all. URLs (in .NET at least) are case insensitive anyway.

Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304