How to uppercase the first letter of a string in appsheet

How to uppercase the first letter of a string in appsheet

0 7 2,316
7 REPLIES 7

I think this would work to capitalize the first letter of [Your text]:

concatenate(UPPER(left([Your text],1)),mid([Your text],2,100))

That works if we assume that the original text is lowercase, and only for the first word.
I can not believe that there is no expression that capitalizes the first letter of each word! (I think I remember using an expression that did it but I canโ€™t find it)
Thanks anyway for confirming that it does not exist, I will work to do it this way.

There is no function to do that. The closest AppSheet provides is this:

@Steve It is not to get the initials what I am looking for, but to capitalize them.
This is what I did and it seems to work well, with the limitations of up to 5 words and 100 characters (in this case).

I created a virtual column named [Nombre y Apellido] where I put all the first and last name in lowercase letters and separate it in a list.

SPLIT(LOWER([Nombre]&" โ€œ&[Apellido]),โ€ ")

Then in another virtual column I change the first letter to uppercase, to the first 5 items of the splited list.
I only have one detail left that I canโ€™t find: in the end of the string I have a comma โ€œ,โ€ and I canโ€™t find out where it is generated, since it should be taken as a blank item in the list.

CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],1),1)),MID(INDEX([Nombre y Apellido],1),2,100))&" โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],2),1)),MID(INDEX([Nombre y Apellido],2),2,100))&โ€ โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],3),1)),MID(INDEX([Nombre y Apellido],3),2,100))&โ€ โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],4),1)),MID(INDEX([Nombre y Apellido],4),2,100))&โ€ "&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],5),1)),MID(INDEX([Nombre y Apellido],5),2,100))

Anyway I solved it in the unorthodox way:

SUBSTITUTE(
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],1),1)),MID(INDEX([Nombre y Apellido],1),2,100))&" โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],2),1)),MID(INDEX([Nombre y Apellido],2),2,100))&โ€ โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],3),1)),MID(INDEX([Nombre y Apellido],3),2,100))&โ€ โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],4),1)),MID(INDEX([Nombre y Apellido],4),2,100))&โ€ โ€œ&
CONCATENATE(UPPER(LEFT(INDEX([Nombre y Apellido],5),1)),MID(INDEX([Nombre y Apellido],5),2,100))
,โ€,","")

To quote myself:

If you ever wanted to remove the 100 character limit (though I canโ€™t possibly understand a name longer than that) you could swap MID(INDEX([Nombre y Apellido],1),2,100) with RIGHT(INDEX([Nombre y Apellido],1), LEN(INDEX([Nombre y Apellido],1)-1).

If possible I try to make sure not to program hard limits into my Apps unless itโ€™s absolutely necessary for functionality (i.e. going through a string one word at a time) or for sync time.

Ah - did not know about LEN and INDEX, thank you! I agree with you about hard limits. My use case was an email address so I did it using the @ as the string terminator: CONCATENATE(UPPER(LEFT([Email Address], 1)), MID([Email Address], 2, FIND("@", [Email Address]) - 2))

Top Labels in this Space