Count the number of upper case letters in a string

I am trying to determine if all letters in a field are capitalized. for example:

String| Count

ABC | 3

abc | 0

Abcd |1

How can I calculate the 'Count' in this example?

Best Answer

  • ColemenWilson
    Answer ✓

    LENGTH(Uppercase) - LENGTH(REGEXP_REPLACE(Uppercase, '[A-Z]', ''))

    If I solved your problem, please select "yes" above

Answers

  • ColemenWilson
    Answer ✓

    LENGTH(Uppercase) - LENGTH(REGEXP_REPLACE(Uppercase, '[A-Z]', ''))

    If I solved your problem, please select "yes" above

  • ggenovese
    ggenovese Contributor
    edited October 29

    I think you have to do this in an ETL, because REGEXP_REPLACE() doesn't work for me inside of a card.

    LENGTH(REGEXP_REPLACE(`sample`,'[^A-Z]',''))
    

  • thanks all!! this was resolved; I used the formula in Data Flow.