Is there a simple way to convert MySQL data into Title Case?

Edit Eureka! Literally my first SQL function. No warranty offered. Back up your data before using. 🙂 First, define the following function: DROP FUNCTION IF EXISTS lowerword; SET GLOBAL log_bin_trust_function_creators=TRUE; DELIMITER | CREATE FUNCTION lowerword( str VARCHAR(128), word VARCHAR(5) ) RETURNS VARCHAR(128) DETERMINISTIC BEGIN DECLARE i INT DEFAULT 1; DECLARE loc INT; SET loc = … Read more

SQL Server: Make all UPPER case to Proper Case/Title Case

This function: “Proper Cases” all “UPPER CASE” words that are delimited by white space leaves “lower case words” alone works properly even for non-English alphabets is portable in that it does not use fancy features of recent SQL server versions can be easily changed to use NCHAR and NVARCHAR for unicode support,as well as any … Read more

RegEx to split camelCase or TitleCase (advanced)

The following regex works for all of the above examples: public static void main(String[] args) { for (String w : “camelValue”.split(“(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])”)) { System.out.println(w); } } It works by forcing the negative lookbehind to not only ignore matches at the start of the string, but to also ignore matches where a capital letter is preceded by … Read more

Convert string to Title Case with JavaScript

Try this: function toTitleCase(str) { return str.replace( /\w\S*/g, function(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); } ); } <form> Input: <br /><textarea name=”input” onchange=”form.output.value=toTitleCase(this.value)” onkeyup=”form.output.value=toTitleCase(this.value)”></textarea> <br />Output: <br /><textarea name=”output” readonly onclick=”select(this)”></textarea> </form>