I still need to client side format 'DMXzone wappler' into 'DMXzone Wappler'

Sorry I remember I’ve posted about this long time ago but I couldn’t find that post anymore.

So here we go again, I need to client side formatter as follows:

‘DMXzone wappler’ into ‘DMXzone Wappler’

and not

‘DMXzone wappler’ into ‘Dmxzone Wappler’

What type of formatter should I use?

1 Like

I hope I didn’t get it wrong.
Have you tried finding a solution with regex?

Hmm how do I achieve it?

value.replace(/\D/g, s/^\(.\)/\U\1/) doesn’t work

I think this will do what you want:
{{'DMXzone wappler'.replace(" ", " | ").camelize().replace("|", " ")}}
If used with dynamic data, you would have to make sure that the temporary separator (eg ‘|’), couldn’t appear in the data of course.

Hopefully there’s a better solution than this - eg it would be interesting to know if regular expressions can be used like this. They can be used in some situations in Wappler.

Have you tried:
<p style="text-transform: capitalize">DMXzone wappler</p>

I wanted to use the formatter to format input value. What I do is on input key up, format the value. CSS only transform the text for display not the actual input value.

I have input mask scrip for that. I just don’t want to add extra script to the site if it is achievable just by using Wappler’s formatter. I remember the team was considering this type of formatter in my previous post but I cannot find the post any more to follow up.

Not sure if this would work as per my requirement but will try it on when I get back to my laptop.

I believe it was the PHP titlecase formatter that resulted in a different output then the other titleCase formatters.

"DMXzone wappler".titlecase() in PHP returns DMXzone Wappler, while in AppConnect and with ASP it returns Dmxzone Wappler.

I think the PHP is indeed better in this case, if nobody has anything against it then I will change the behavior of the titlecase to that of PHP. To get the old behavior back you can then change your expression to "DMXzone wappler".lowercase().titlecase().

4 Likes

Agreed and please implement it… :pray: