Quote:
Originally Posted by shajiuddin
Hi,
I need to change string format like every first letter of word should be in capital and '.' should be replace with space ' ' and this string may be any format
For example: 'bret.blunt' or 'BRET BLUNT' or 'BretBlunt' or 'BrRtBlUnT' should be 'Bret Blunt'
Which function I have to to use please help
Regards
|
You're going to run into problems with 'BrRtBlUnT' because there is no logical separation between 'Bret' and 'Blunt'.
For the other strings you have a period, space, and Pascal casing respectively to identify the break in the string.
So before I even attempted to address your original question, I think it would be best if you first narrowed down 'any format' to at least a group of formats that contain identifiable and/or common patterns -- that we can then apply some regular expression or series of PHP functions to, to solve your problem.