Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

changes on string

Hi Community,

I have a country field with all small letters

Now the requirement is change it to only first letter should be  in capital letter.

How can we achieve this requirement. I have tried with sub field function but no use.

Any suggestions please help

Thanks in advance!

1 Solution

Accepted Solutions
sunny_talwar

Sample script where I am pulling data from wikipedia

FOR i = 1 to 23

  Table:

  LOAD Lower(PurgeChar([Country (exonym)], '[]0123456789')) as Country

  FROM

  [https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_and_their_capitals_in_native_langua...]

  (html, codepage is 1252, embedded labels, table is @$(i));

NEXT

FinalTable:

LOAD Country as Lower_Country,

  Capitalize(Country) as Capitalized_Country,

  Upper(Left(Country, 1)) & Right(Country, Len(Country) - 1) as First_Letter_Capitalized_Country

Resident Table;

DROP Table Table;

Output:

Capture.PNG

View solution in original post

5 Replies
trdandamudi
Master II
Master II

May be like this:

capitalize ('london')  and it will return 'London'

luizmendes118
Contributor III
Contributor III

Maybe the function

Capitalize(countryField)

sunny_talwar

What happens if it is two word country name like united states, would you want United States or United states?

If you want United States, then what has been proposed should work like a charm for you -> Capitalize(Country)

If(you wanted United states, then you can try this: Upper(Left(Country, 1)) & Right(Country, Len(Country) - 1)

sunny_talwar

Sample script where I am pulling data from wikipedia

FOR i = 1 to 23

  Table:

  LOAD Lower(PurgeChar([Country (exonym)], '[]0123456789')) as Country

  FROM

  [https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_and_their_capitals_in_native_langua...]

  (html, codepage is 1252, embedded labels, table is @$(i));

NEXT

FinalTable:

LOAD Country as Lower_Country,

  Capitalize(Country) as Capitalized_Country,

  Upper(Left(Country, 1)) & Right(Country, Len(Country) - 1) as First_Letter_Capitalized_Country

Resident Table;

DROP Table Table;

Output:

Capture.PNG

Not applicable
Author

Thanks to everyone for your suggestions.!