Jump to content

Proper, but not for everything


This topic is 3255 days old. Please don't post here. Open a new topic instead.

Recommended Posts

For some fields I use the Proper() function to return the first letter of each word as uppercase, and that works.

Only, when there is "sa de cv" at the end of the text (all upper case or mixed), it should be/stay as "sa de cv".

Is there a clever calc to put the text in Proper(), except that part, that has to be all in lower case ?

I tried several combinations Proper()/Lower()/Substitute with no success, except knowing what is not working. So it is not all wasted time....

 

Link to comment
Share on other sites

Thanks Comment.

I stumbled over some other forms of "writing".

S. A. DE C. V. and S.A de C.V. (and some other weird combinations)

I suppose I have to add a Substitute part as:

[ "S. A. DE C. V.§" ; "sa de cv" ] ; [ "§" ; "" ]

to make it work ?

Link to comment
Share on other sites

No, you'll have to make it:

Substitute ( Proper ( text ) & "§" ; 
[ "Sa De Cv§" ; "sa de cv" ] ; 
[ "S. A. De C. V.§" ; "sa de cv" ] ; 
[ "S.a De C.v.§" ; "sa de cv" ] ; 
[ "§" ; "" ] 
)

Note that Substitute() is case-sensitive, so in order to save on substitution pairs it's better to do the Proper() part first. This means that any "weird combination" you want to add needs to be added in its Proper form: "S. A. DE C. V." --> "S. A. De C. V." and "S.A de C.V." --> "S.a De C.v.".

Link to comment
Share on other sites

Oh shoot !!

Even a space as last character gives problems.

So the Trim() function has to come before the Proper.

First Trim (remove not needed spaces) then Proper, then Substitute all weird combinations

Link to comment
Share on other sites

This topic is 3255 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.