Making the first letter of every word a capital

hello CF oracles
could you guys please advise me the best way to make the
first letter in every word of a string a capital letter. (and make
all the other letters lower case).
eg. convert "the quick brown fox" into "The Quick Brown Fox"
or convert "THE QUICK BROWN FOX" into "The Quick Brown Fox"
I am taking form data and inserting it into my table, so i
want to get it right as the data is inserted.
i found a "UDF" on CFLIb.org that proports to do this, but i
don't know how to set up a UDF, are there other ways or is this
considered the best approach.
http://www.cflib.org/udf.cfm?id=9&enable=1
thanks for any help you can give me

found it, here's the top info, Titlecase is what you want for
this.:
changecase.cfm
Rev 1.01
cf_changecase is a simple custom tag to format case in given
string.
(c) 2001, Rizal Firmansyah, [email protected]
Input var:
* case (mandatory)
possible inputs are
- sentencecase: Sentence case (default)
- titlecase: Title Case
- lowercase: lowercase
- uppercase: UPPER CASE
"happysailingdude" <[email protected]> wrote
in message
news:e46tjv$e30$[email protected]..
> hi Dan thanks very much. I have made an executive
decision to do a bit of
> a
> hack for now as my site is only small so if a user
enters something in the
> wrong way i can quickly manually update it myself.
>
> so now i have this which works 9 times out of ten if the
user enters a one
> word name eg "bill" or "fred" of "jane" then it works
just fine
>
> the only time it doesnt work is if the user's name is
more than 1 word (or
> is
> hyphenated) eg "mary anne" or "anne-marie" hence the
first cfif line - in
> these
> cases i can manually update
>
> i put this here in case it is of use to anyone else
>
> cheers
>
> <cfif not (FORM.firstName contains " " or
FORM.firstname contains "-")>
> '#Left( UCase( "#FORM.firstName#" ), 1 )##Right( LCase(
> "#FORM.firstName#" ), Len("#FORM.firstName#" ) - 1 )#'
> <cfelse>
> '#FORM.firstName#'
> </cfif>
>

Similar Messages

  • How to Capitalize the First Letter in Every Word in Mysql

    Hi,
    I have been trying to tidy up a massive database where visitors have been sloppy when entering text. The main thing I want to do is to Capitalize The First Letter In Every Word In Mysql.
    I have found the code below in PHP but it keeps finding an error on the WHILE line:
    <?php ini_set('display_errors', '1'); ?>
    <?php require_once('Connections/maison_connection.php'); ?>
    <?php
    $result = mysql_query ("SELECT column, id FROM table");
    while ($row = mysql_fetch_array($result)) {
    $id = $row["id"];
    $column2 = ucwords($row["column"]);
    $query2 = "UPDATE table SET column = '$column2′ WHERE id = '$id'";
    mysql_query($query2);
    ?>
    My table is called MailingList and the Column is called Name, so I have altered the script to this: but it still shows the same WHILE error:
    <?php ini_set('display_errors', '1'); ?>
    <?php require_once('Connections/maison_connection.php'); ?>
    <?php
    $result = mysql_query ("SELECT Name, id FROM MailingList");
    while ($row = mysql_fetch_array($result)) {
    $id = $row["id"];
    $Name2 = ucwords($row["Name"]);
    $query2 = "UPDATE MailingList SET Name = '$Name2′ WHERE id = '$id'";
    mysql_query($query2);
    ?>
    Any ideas??

    I got it to work this way in SQL: I am SURE there is an abbreviated way to do it, but at least it works
    UPDATE MailingList SET Name = replace(Name," a"," A");
    UPDATE MailingList SET Name = replace(Name," b"," B");
    UPDATE MailingList SET Name = replace(Name," c"," C");
    UPDATE MailingList SET Name = replace(Name," d"," D");
    UPDATE MailingList SET Name = replace(Name," e"," E");
    UPDATE MailingList SET Name = replace(Name," f"," F");
    UPDATE MailingList SET Name = replace(Name," g"," G");
    UPDATE MailingList SET Name = replace(Name," h"," H");
    UPDATE MailingList SET Name = replace(Name," i"," I");
    UPDATE MailingList SET Name = replace(Name," j"," J");
    UPDATE MailingList SET Name = replace(Name," k"," K");
    UPDATE MailingList SET Name = replace(Name," l"," L");
    UPDATE MailingList SET Name = replace(Name," m"," M");
    UPDATE MailingList SET Name = replace(Name," n"," N");
    UPDATE MailingList SET Name = replace(Name," o"," O");
    UPDATE MailingList SET Name = replace(Name," p"," P");
    UPDATE MailingList SET Name = replace(Name," q"," Q");
    UPDATE MailingList SET Name = replace(Name," r"," R");
    UPDATE MailingList SET Name = replace(Name," s"," S");
    UPDATE MailingList SET Name = replace(Name," t"," T");
    UPDATE MailingList SET Name = replace(Name," u"," U");
    UPDATE MailingList SET Name = replace(Name," v"," V");
    UPDATE MailingList SET Name = replace(Name," w"," W");
    UPDATE MailingList SET Name = replace(Name," x"," X");
    UPDATE MailingList SET Name = replace(Name," y"," Y");
    UPDATE MailingList SET Name = replace(Name," z"," Z");

  • Is there a way to auto capitalize the first letter of every word?

    I Like To Type In This Way. I Was Wondering If There Is A Setting That Will Automatically Capitalize The First Letter Of Each Word So That I Don't Have To Keep Hitting Shift Before Each First Letter.
    Thank You

    AdamMarshall wrote:
    Nice to see so many 'helpful' responses.
    This casing is useful for example, on an Address field. It would be good if the OS had this option for developers.
    I'm pretty sure it does as I've certainly had apps that, in certain fields, do use title case.

  • Is their a way to turn on auto-capitalization of the first letter of every word??

    i want da first letter to be in caps without me pressing caps lock or using shift
    i.e Like This But Without Using Those Two Keys

    There have been some threads here about large-scale deployment, but I don't know whether they would help after Firefox has been installed.
    Random thought:
    I suspect (but haven't checked) that changing the "Clear Recent History" options would add corresponding entries to prefs.js in the user's profile folder. (These usually are added during Firefox shut-down.) That's just a plain text file and you could append to it by a variety of means.
    It might be possible to use a VBScript during logon to update that file before the user starts Firefox. The script would have to detect the random folder name(s) in order to make the update.

  • Can iTunes capitalize the first letter of every word?

    I know there are id3 tag software for this but they are confusing and all that i have tried have all messed up my music. I like it organized. I just want everythign capitalized and if I look at my music in windows explorer i just want to see...
    Tr# Title
    01 Stairway To Heaven
    I have it all organized in folders so i dont need anything else. But i just want to capitalize everything can itunes do this? thanks.

    Try searching VersionTracker for "tag editor" and perhaps you'll come up with something you can use.
    Oh, and I really don't mean this as a flame, but you waited less than twelve hours, most of those being the wee hours of the morning in the US. So you weren't likely to get a response during those times. Just to set expectations for future posts. Cheers.
    Message was edited by: Dave Sawyer

  • FM to translate first letter of every word to upper case.

    Hi all,
    I have a requirement to change the first letter of every word in sentence to Upper case.For example if the sentence is 'fifty eight thousand' it has to be changed to 'Fifty Eight Thousand'.Is there any FM to acheive this? Any help would be highly appreciated.
    Thanks and Regards
    Kiran.

    it is useful for u :
    FM:ISP_CONVERT_FIRSTCHARS_TOUPPER
    OR u can user below code:
    translate output_string to lower case.                 
      pos_max = strlen( output_string ) - 1.
      pos = 0.
      assign output_string+pos(1) to <poi>.
      assign input_string+pos(1)  to <hpoi>.
      <poi> = <hpoi>.
      assign input_string+pos(*) to <rest>.
      while <rest> ca separators.
        pos = pos + sy-fdpos + 1.
        if pos > pos_max. exit. endif.
        assign output_string+pos(1) to <poi>.
        assign input_string+pos(1)  to <hpoi>.
        <poi> = <hpoi>.
        assign input_string+pos(*) to <rest>.
      endwhile.

  • How to capitalize the first letter of each  word in a sentence?

    Can anyone please explain how to split a sentence at a comma, or space or hyphen in to words and capitalize the first letter of each word. But I don't know how many words the sentence contains.

    HI,
    data : begin of itab occurs 0,
             words(40),
             end of itab.
    data : v_sentence(1000).
    data : lv_firstchar.
    split v_sentence at ',' into table itab.
    loop at itab.
    translate itab-words+0(1) to upper case.
    modify itab index sy-tabix.
    endloop.

  • Is there a command to capitalize the first letter of each word?

    That is to say, can you capitalize the first letter of each word in a document like say, word? Or using the net?
    Thanks guys.
    (hope that makes sense.)

    Select the text, then Format->Change Case->Title Case (Word 2004).

  • I don't want the first letter of every line to be capitalized

    When I try to put in user id's and passwords on web sites, I don't always want the first letter to be capitalized.  How do you make the Ipad stop doing this?

    Settings -> General -> Keyboard
    Turn off Auto-Capitalization.
    Regards.

  • Getting the autocomplete setting to work by typing the first letter of a word

    Before I installed Firefox 5.0, I had made it so that whenever I visited a website that remembered an account/password of mine, this happened:
    1.- It asked for my master password.
    2.- After entering it, I would click on the form field and then type in the FIRST LETTER of the account.
    3.- When entering that exact first letter, Firefox would suggest in a drop-down menu the account or accounts that started with that letter on that particular site, e.g.: say I have a Twitter account that is "koko999". If I went to twitter.com and entered the letter "k" in the form field (after entering the master password), Firefox would suggest the account "koko999" in the drop-down menu.
    4.- After selecting the account that I desired from the drop-down menu, Firefox would automatically autocomplete the password.
    5.- Then, if I closed Firefox, all my active accounts would close/sign out. So, if afterwards I opened Firefox, I would have to repeat from Step 1 if I wanted to use an account, e.g.: if I closed FF while having my Twitter account logged in, and then opened FF again, I would have to start from Step 1.
    Now, I had this setting for a bunch of different websites. After installing Firefox 5.0, this configuration vanished or something. Now, when entering the master password, Firefox autocompletes EVERYTHING. Say, using the example from before, that I go to twitter.com. Firefox asks for the master password, I enter it and then the ID/password for the twitter account automatically fills in without me entering any letter in the form field. And I do not want Firefox to do that!
    So, I'm asking for help. I know that what I what to do is not impossible, I just can't find the way to do it! I kinda need the exact steps. Thanks a lot!

    See:
    * http://kb.mozillazine.org/Password_only_filled_after_entering_user_name
    * http://kb.mozillazine.org/signon.autofillForms (false)
    If you are in Private Browsing then Firefox wont fill the names and passwords automatically.
    You can set the pref <b>browser.sessionstore.privacy_level</b> to 2 (never) or 1 (non-HTTPS, default in Firefox 3 versions) on the <b>about:config</b> page to disable saving cookies via session restore.
    * http://kb.mozillazine.org/browser.sessionstore.privacy_level
    You can also use [[Clear Recent History]] to clear the "Active Logins" when you close Firefox.
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    You can use the Filter bar at to top of the about:config page to locate a pref more easily.

  • Capitalize the first letter after full stop.

    Since I m not a Java Programmer, my speciality is PERL. I m looking
    for a little support from any of the Javascripts Gurus here. Its
    going to take 5 or less minutes for you to solve this issue.
    I have a textbox and I want when users are typing in it. The word
    after full stop (.) will be capitalized just like MS-Word. I mean
    the begining of the new sentence with capital letter, users don't
    have to push "shift" button to capitalize the first letter after
    every full stop .
    thanks for your help.
    Any Ideas,
    Zeshan.

    Try Google. Have you heard of it? www.google.com
    do a search!

  • Apple wireless keyboard misses first letter in some words

    When I am typing, particularly in Word 2011, with my Apple Wireless Keyboard, it frequently does not type the first letter of a word.  I have searched and can find no resolution to this problem.  I have messed with Accessibility but that is all turned off.  The only other bluetooth device is my mouse.

    Hi,
    Thanks for this. It isn't the computer though, as it will happen very quickly. For example I can type in a web address, then look up to read the web page for 20 seconds or so, then if I type again it will miss the first key stroke.
    I am starting to get used to typing the first letter twice!
    I can see that it is a widely reported issue with Apple Macs, but I can't find a fix for Windows. I am keen not to have to buy a new keyboard!
    T23

  • How to capitalize the first letter

    Yesterday, I upgraded my operating system and pages on my Mac.  However, I can't capitalize the first letter after every sentence.  Can you please help me with this problem of mine? 
    Thank you,
    Vic.   

    I have the same problem. For the previous Pages, the problem is solved by +Menu > Preferences > Auto-Correction Preferences > check Fix Capitilization+. For this update I cannot find any solution!

  • Capitalize the first letter?

    Is there a way in CF to capitalize the first letter of a
    word?

    cf_dev2 wrote:
    > One way is using string functions. Left() to grab the
    first letter and
    > UCase() to capitalize it. You can use Right() and Len()
    to grab the rest of
    > the word.
    >
    > You can see an example of something similar at
    cflib.org. But read the usage
    > on how it operates if you pass multiple words.
    >
    http://www.cflib.org/udf.cfm?ID=9
    >
    Perfect. Thank you!

  • How to Capitalize the first letter or an entire word using a shortcut on the keyboard just like in microsoft that uses shift+F3

    please how can one How to Capitalize the first letter or an entire word using a shortcut on the keyboard just like in microsoft that uses shift+F3

    What do you mean there was "no effect?" I'm not aware of any effects.
    It looks like that Service is also in the App Store. From their screen shots, the services are prefaced with WordService:
    You can see an example in the App Store for their app: App Store
    After installing, you should now have those text services in your Services menu. You can then add shortcuts in the Keyboard System Prefs.
    Most Apple apps have a Transformations menu in the Edit menu. You can Make upper, lower, and Initial caps with those. I would stick with Word Services, but you can make Application Shortcuts for the items in the Transformations menu.
    Again, in Keyboard System Prefs, Under Applications, Click the Add button on the right side pane.
    Set it for All Applications
    Enter the menu command exactly as they appear in the Transformation menu (separate entries for each),
    Make Upper Case
    Make Lower Case
    Capitalize
    Give them a shortcut.

Maybe you are looking for

  • HT2801 I do not see my dvd drive listed in the devices area of my MacBook Pro. How can I fix this problem?

    My optical drives is working on my MacBook Pro laptop. However when I insert a DVD of any type I do not see it listed among the devices. I see the Mac Hard disk drive, Skype, idisk etc but no drive "D" or the DVD Drive. This is especially fraustratin

  • Help! When i click and drag, only the frame moves!

    So when i drag a pictue in a frame, whether its eps, png watever, only the frame outline drags with my mouse, the content stays where it started, then when i relese click in a new place the content moves to it. I think this is some sort of fast mode

  • How to block a delivery

    Dear Gurus, My question is once a delivery is created and saved, due to some reasons I need to block it from furthur processing, that is, no one should be able to do PGI. I dont want to delet it since I need to keep a track of these kinds of document

  • Migrating data from one databaes to oracle?

    is there any way to migrate my data from my old/previous database to oracle db. ie. migrating data from one databaes to another.

  • Mp4 imports but looks different in project window

    I imported an mp4 into iMovie's event library just fine;  once I pullled it up into the project window it looks jaggy and pixelated.  Is this a temporary view of it?  Will it look like the original clips once it's exported?  I'd be grateful for insig