Next / Previous / Contents / Shipman's homepage

4.22. deCamel(): Convert CamelCase names to dashed names

This function is used by Section 4.21, “dash(): Attribute set builder” to transform each key name, but it may have standalone applications in XSL-FO work. The prototype:

deCamel(name)

The name argument is a string. The function returns name but with every lowercase-to-uppercase transition "xY" replaced by "x-y".

>>> import fohelpers as h
>>> h.deCamel('simplePageMaster')
'simple-page-master'