function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tin013Tin013 

Initial Upper Case Formula

Hi,

I would like the data in the first line of the address field to look like 

 

10 Downing Street.

 

Is there a way to capitalise the initials using formula?

 

Many thanks,

 

yudhvirmoryudhvirmor

By writing validation rule and use UPPER(Street). It'll enforce users to enter infromation in upper case.. Alternatively you can write workflow to update the Street when record created/edited.

Tin013Tin013

Thanks for your reply.

I don't really want to replace the whole line of street to UPPER CASE, I only want the initial of street names (non numeric) to be Upper case. 

 

Thanks,

yudhvirmoryudhvirmor

Street field length is 80 I think, Build logic where we check LEFT(n) with Left(n-1) and whenever Left(n-1) is equal to blank. Change Left(n) to UPPER (Left(n)

 

 

Tin013Tin013

Have done that already - UPPER(LEFT(Street,1))&LOWER(Mid(Street, 2, Len(Street)-1))

but that only returns the first letter to uppercase and the rest to lower and it doesn't work if there is a numeric values in the street too.

 

With the formula above

10 Downing Street will look 10 downing street and Downing Street will look Downing street.

 

That's not exactly what I am after, I am afraid.

 

Thanks for your replies anyway.

SurekaSureka

Hi,

 

You can try the below code in the before update trigger.

 

String s = a.MailingCity;

List<String> varMailingCity = s.split(' ');

for(Integer i=0;i<varMailingCity.size();i++)

{

varMailingCity[i] = (varMailingCity[i].substring(0,1)).toUppercase() +(varMailingCity[i].substring(1,varMailingCity[i].length()));

}

 

Now the varMailingCity contains as you expected.

 

Hope this helps.

 

Thanks

Sureka

Justin DoverJustin Dover
I found this code after alot of searching. Figured i would post to help. This will do # in front of street and up to two names. 

So 100 tom boyd drive =  100 Tom Boyd drive

It will not get the 3rd and forth name in the street field. But i am sure it can be fixed with some editting. 

IF(
FIND(" ", Street ,1)=0,
UPPER(LEFT(Street ,1))&MID(Street ,2,100),
IF(
FIND(" ",MID(Street ,FIND(" ",Street ,1)+1,LEN(Street )-FIND(" ",Street ,1)))=0,
UPPER(LEFT(Street ,1))&
MID(Street ,2,FIND(" ",Street ,1)-1)&" "&
UPPER(MID(Street ,FIND(" ",Street ,1)+1,1))&
MID(Street ,FIND(" ",Street ,1)+2,100),
UPPER(LEFT(Street ,1))&
MID(Street ,2,FIND(" ",Street ,1)-1)&" "&
UPPER(MID(Street ,FIND(" ",Street ,1)+1,1))&
MID(Street ,FIND(" ",Street ,1)+2,FIND(" ",MID(Street ,FIND(" ",Street ,1)+1,LEN(Street )-FIND(" ",Street ,1)))-1)&
UPPER(MID(Street ,FIND(" ",MID(Street ,FIND(" ",Street ,1)+1,LEN(Street )-FIND(" ",Street ,1)))+FIND(" ",Street ,1)+1,1))&
MID(Street ,FIND(" ",MID(Street ,FIND(" ",Street ,1)+1,LEN(Street )-FIND(" ",Street ,1)))+FIND(" ",Street ,1)+2,100)))
Raghuram GowlikarRaghuram Gowlikar

@Justin Dover, Thanks for the formula and inserted in formula field and got the output. But need some breif because it is working for 3 words of a sentence but i need for 10 words in a sentence should be in proper case.

Unable to edit the logic with lot of confusion please can you suggest me

Justin DoverJustin Dover
@Reghuram,  Thanks for asking but as I stated in my comment, I did not originate this code/Formula.
Kewal Hirudkar 5Kewal Hirudkar 5
Hi, Please try this simple formula, It will make the first letter capitalize:

INITCAP(Street)