Bug report #4425

Add a capitalize() function to the expression based labeling engine

Added by Mathieu Pellerin - nIRV over 12 years ago. Updated almost 12 years ago.

Assignee:Nathan Woodrow
Category:Map Canvas
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14357


This probably doesn't require a long description. It'd be useful for the expression based labeling engine to have a capitalize() function.

Typical case study: Bob gets a shapefile of protected areas in which the name of each area is saved in uppercase (e.g. 'PHNOM TAMAO', 'BOTUM SAKOR') to add to his project. Bob doesn't want to use uppercase strings there because another set of features on his map uses uppercase strings.

With the capitalize() function, Bob could simply go to the expression based labeling engine and input capitalize(P_AREA_NAME).


#1 Updated by Martin Dobias over 12 years ago

A little bit of research on function name in other SQL databases:

postgresql, oracle: initcap( x )
mysql, ms sql: not available (?)

#2 Updated by Nathan Woodrow over 12 years ago


Seems that MS SQL doesn't have a function. You have to define your own :S I suggest we follow postgresql and go with inticap(x). postgresql seems to follow the standard better than anyone else, so I think they are a good model to base the functions off.

#3 Updated by Giovanni Manghi over 12 years ago

  • Target version set to Version 1.7.4

#4 Updated by Paolo Cavallini about 12 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0
  • Crashes QGIS or corrupts data set to No
  • Affected QGIS version set to master

#5 Updated by Alister Hood almost 12 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

There is an upper() function, which is what I initially thought this ticket was about, in at least master (not sure about 1.8).

And there is now a title() function in master to convert to title case, which I think is what this ticket is actually about.

Also available in: Atom PDF