Use the first and third letters in names like McArthur or McMinn

Is there a way to identify compound names and use the first and third character correctly?

While changing the case is a trivial task using CSS when dealing with compound names, I haven't found a direct solution.

One thing that comes to mind is using some sort of kind to identify names like LeBare, McDonalds, McArthur, etc. and then apply some logic to make a difference ... everyone knows about any other viable solutions what could be out there so I won't reinvent the wheel (so to speak)?

Note. Users will enter these names directly into the text box. There is no guarantee that the user will not enter something like mcMinn or macArthur, etc. Having said that, I also notice names with the prefixes "Le" and "La" (these are names that have Latin / Spanish roots, perhaps I could be wrong though).

+3


source to share


2 answers


One thing to remember during this process is that you could also be dealing with MacArthur, where it would be the first and fourth characters. Depending on where you are fetching the data (user input, database, etc.), I would say using it as it might be an option. However, if the name comes in as all lowercase, you might have to compile a list of known name prefixes and check it. My point is that if the names don't appear as all lowercase and are displayed to the user, I would just use the original formatting.



0


source


You cannot do this with CSS alone. There are several jQuery plug-in "labels" such as http://letteringjs.com/ . You can put your own name based logic in jQuery and create each letter with a label library like



.target.char1, .target.char3 {
  text-transform:uppercase;
}

      

0


source







All Articles