-1

I want to create regex which should work with tag. Example code is as follows:

<div class="numericGoalMetFooter ng-binding">
                    Total time(s)
</div>

If I use css text-transform: capitalize then output follows:

Total Time(S)

I want the text as follows:

Total Time(s)

Note : "time(s)" comes dynamically from database. Thanks in advance for your answers.

GsMalhotra
  • 1,759
  • 3
  • 12
  • 21
  • How about wrapping them in `spans` and capitalize only `Total Time`? – Papi Sep 14 '18 at 10:09
  • Is it an option to modify whatever supplies that text to just be correct? – VLAZ Sep 14 '18 at 10:09
  • Actually , Total time(s) comes dynamically from database. – GsMalhotra Sep 14 '18 at 10:10
  • 2
    So, is it an option to correct it in the database? If not, then that might be simpler than trying to do a postfix every time you get the value. – VLAZ Sep 14 '18 at 10:14
  • Can't you do it similar to the answer here: https://stackoverflow.com/questions/5280015/first-lowercase-the-text-then-capitalize-it-is-it-possible-with-css and use another regex for the matching something like: `\b(? – gaw Sep 14 '18 at 10:23

1 Answers1

0

As, I was using angularjs so I created custom filter and remove text css.

Angular custom filter:

app.filter('capitalize', function() {
        return function(input) {
            return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).toLowerCase() : '';
        }
    });

Html:

<div class="numericGoalMetUnit">
    Total {{challenge.unit  | capitalize}}
</div>
GsMalhotra
  • 1,759
  • 3
  • 12
  • 21