Thanks a lot kh99.
Definitely looking forward to your next version of it.
And I'm sorry about the PM, I don't know how but somehow didn't see your notice about it in your signature. Won't happen again!
--------------- Added [DATE]1348668746[/DATE] at [TIME]1348668746[/TIME] ---------------
Hi guys,
Based somewhat off of kh99's previous code I went ahead and wrote some new code for my purposes. Not sure if anyone else would find this useful or not but I figured I would share it just in case.
This code does the following:
- Automatically capitalizes first letter of every word.
- Ignores user defined small words (a, the, of, and, etc).
- Ignores user defined acronyms (USA, LOL, BRB, etc) and will capitalize them if they are not entered in all caps.
- Allows you to define a max length for capitalized words. If a thread has a word in all caps longer than the max length, it will change it from all caps to only capitalizing the first letter of that word. Prevents "shouting" and also helps cover any acronyms that were not specifically declared in the capital words list by ignoring any words entered in all caps that are less than the defined max length.
- Correctly handles punctuation marks and having a punctuation mark at the end of a word on the capital words list won't mess it up. 'USA!' will match 'USA' on the list.
One thing to be careful about -- enter all of your words in lowercase.
I hope this is helpful to someone else!
Here's the code:
[Look at next post for code]
Edit: If someone could help make it so that I could read an external file for the capitalized words list, that might be a neater solution. Not exactly sure how to go about doing that.
Edit #2: Ok it looks like there is an issue I'm having trouble getting rid of. If the letter 'i' is entered in lowercase such as in the sentence "i really like cake with a tiny bit of icing" it will capitalize the letter 'i' which it should do but then it will also capitalize every other instance of the letter 'i' anywhere it occurs. The output will be: "I Really L
Ike Cake W
Ith a T
Iny BIt of Ic
Ing".