Check for brackets in a data item and update first letter to uppercase?

Gary96

Member
Hi All,

I need to check if Brackets are present in a data item. If yes I then I need to remove any blank space inside the brackets. I then need to the set the first letter of the word in the data item to upper case and keep the brackets in place.
Test
Data Item = (john )
Expected result = (John)
 

sahil_raina_91

Active Member
Hi All,

I need to check if Brackets are present in a data item. If yes I then I need to remove any blank space inside the brackets. I then need to the set the first letter of the word in the data item to upper case and keep the brackets in place.
Test
Data Item = (john )
Expected result = (John)

Will the value of data item always begin with ( and end with ) ?
If not, please list all possible variations
 

Gary96

Member
No the data item could be as = john (joe ) , john( joe), john(Joe)
It will never be (joe). There will always be a word preceding it.
Expected result = John (Joe)
 

sahil_raina_91

Active Member
No the data item could be as = john (joe ) , john( joe), john(Joe)
It will never be (joe). There will always be a word preceding it.
Expected result = John (Joe)

1) [Name] is the original data item
Trim(Left([Name],InStr([Name],"(")-1))&" "&Replace(Mid([Name],InStr([Name],"("),Len([Name]))," ","")

2) [New Name] is the data item storing result from Step 1
Upper(Left([New Name],1))&Mid([New Name],2,InStr([New Name],"(")-1)&Upper(Mid([New Name],InStr([New Name],"(")+1,1))&Mid([New Name],InStr([New Name],"(")+2,Len([New Name]))
 
Top