How to uppercase the first letter of a string in appsheet
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))
Here's my approach. I used to do this in excel, combining MID and FIND to get the position of the spaces. In my case I have a full name, which might contain two words and a then two different columns for first and second lastname. Sooo....
First name CONCATENATE(INITIALS(INDEX(SPLIT([alta_nombre];" ");1)),mid(LOWER([alta_nombre]),2,FIND(" ";[alta_nombre])-2) &" "&
Second name CONCATENATE(INITIALS(INDEX(SPLIT([alta_nombre];" ");2)),mid(LOWER([alta_nombre]),FIND(" ";[alta_nombre])+2,100))) &" "&
First lastname CONCATENATE(INITIALS([alta_primerapellido]),mid(LOWER([alta_primerapellido]),2,100)) &" "&
Second lastname CONCATENATE(INITIALS([alta_segundoapellido]),mid(LOWER([alta_segundoapellido]),2,100))
I hope it can be worthy for somebody!
User | Count |
---|---|
20 | |
16 | |
4 | |
3 | |
2 |