Replacing first Character of every word in a string with an Uppercase

Hi,
Is it possible to replace all first character of every word in a string with UpperCase?
$="autocad lite"
Should look "Autocad Lite" .
Thanks,
François

Hi FRacine,
Please refer to the script below:
$givenname="autocad lite"
$givenname
$givenname = $givenname.substring(0,1).toupper()+$givenname.substring(1)
$givenname
Edit: to change first character in every word, please refer to this script, this may not be the best way, but it can work:
$givenname="autocad lite"
$givenname
$words=$givenname.split(" ")
$givenname=""
foreach ($word in $words){
$givenname+=$word.substring(0,1).toupper()+$word.substring(1)+" "}
$givenname=$givenname.trim()
$givenname
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang

Similar Messages

  • 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>
    >

  • 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");

  • First character in each word

    Hello All,
    I want to get the first character of each word:
    If I have "Statement To Be Parsed" so i want a query to return STBP.
    Your help please

    Hi,
    NB wrote:
    Hello Franck,
    One more thing i have the below case which is not covered
    "Test STMT Func/ Brg E.O.D Act ON LINE/ Ext" i want it to be TSF/BEAOL/E
    please your help againINITCAP conisders '.' to mark the end of a word, so INITCAP ('E.O.D.') returns 'E.O.D.' (all capital letters). If you want to ignore '.'s, so that you get 'Eod' (only 'E' capitalized) as a result, then use REPLACE (or some other string manipulation function) to get rid of the '.'s before calling INITCAP.
    REGEXP_REPLACE (str, '[^A-Z]') returns a copy of str with all characters except those indicated inside the square brackets removed. If you want other characters (such as '/') kept, then just add them to the list inside the square brackets, like this:
    SELECT     REGEXP_REPLACE ( INITCAP ( REPLACE ( 'Test STMT Func/ Brg E.O.D Act ON LINE/ Ex'
                     , '[^A-Z/]'
                     )     AS inits
    FROM    dual;Output:
    INITS
    TSF/BEAOL/E

  • 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 read each and every word from a string.

    Hi all,
       I have a string which is having many label numbers. if the string is lv_str, its value is like, 11111111111111##22222222222222##3333333333333.
    I need to move the values alone into internal table. each value should be updated as a single row into one internal table. How to read each and every word of the string and move to an internal table.
    the internal table should be like this.
    11111111111111
    22222222222222
    3333333333333
    Can any one give me a suggestion in this regard.
    POINTS PROMISED.
    Regards,
    Buvana

    Hi,
    If you know the format and length of the data
    Use split at '#' so that you will get the individual values.
    Thean append it to internal table.
    Reward iof helpful.

  • 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

  • First letter Capital of every word in a expression

    Hi Experts,
    I am trying to do a check using the match_regex to check in a expression if the first letter of every word are in capital.
    If it find all staring letter in capital for every word in an expression then only it should return 1 else 0
    Can anybody guide me on this.
    Example : I Will Go Home - should return 1
                      I will go home   - should return 0

    $num = 1;
    while(word($inputstr,$num) != NULL)
    begin
    if(word($inputstr,$num) != init_cap(word($inputstr,$num)))
    begin
    return 0;
    end
    $num = $num + 1;
    end
    return 1;

  • First Character " " in shorttext is convertet to " ( ) "

    High there,
    when CONVERT_STREAM_TO_ITF_TEXT is used to convert first 40 characters of a longtext into shorttext and the first Character is a "<", the resulting shorttext starts with "<(><<)>". This is a function of FU CONVERT_STREAM_TO_ITF_TEXT. Sometimes we need the "<" as first char to explain results. Does anybody know how we can pass this conversion (maybe with a leading char like \ or so)?
    Thanks, Harry

    KB 1388221

  • The first character I type often ends up at the end of the word.

    It's been going on since at least Snow Leopard, I'm on a clean Lion install now. It happens relentleslly in Safari. When I type in a search or fill a form on a webpage - even something simple as google, the first character I type often ends up at the end of the first word I type. Sometimes it ends up in the middle. If anyone esle has even observed it, i'd like to hear just to confirm I'm not mad.

    See:
    * http://kb.mozillazine.org/Deleting_autocomplete_entries

  • CS6 Spell Check flags every word.

    Hello,
    My ID has recently started flagging every word when doing spell check. I uninstalled and reinstalled but it's still doing it. I have tried turning on and off preferences and selecting different vendor dictionaries but no luck. I have no clue how to create a new dictionary or to select a different one. If I try to "relink" the current one everything is grayed out. Please help! I'm spending so much time trying to research this and getting nowhere! Thanks!

    KHCAP wrote:
    Hello,
    I have tried turning on and off preferences and selecting different vendor dictionaries but no luck. I have no clue how to create a new dictionary or to select a different one.
    This is a common point of confusion for many users (including me for a few years). The Dictionary settings in your presfs have nothing to do with spell checking directly. What they are is a means for you to choose which dictionary to use for each language, if more than one dictionary happens to be installed for that language. that dictionary is then used to decide if words are spelled correctly and to set hyphenation rules, but the language is actually set at the character level, as Manish mentioned above.
    ID looks at the language assigned to the text, then uses the dictionary assigned by your prefs to do the checking. If the assigned language doesn't match the actual language, most words will inevitably be considered misspelled. If you, for example have an English localized version of ID, but mostly type in French, you probably would want to set French as the default language. To do that you would set it from the language dropdown in either the Character or Control panel with no files open, and it will be effective for all new work.
    Existing files are more of a problem. You can reset the default for each document in the same way, but exiting text will retain whatever language is currently assigned, whether is it is correct or not. You can use Find/Change to reassign any language you like to the entire document on a language-by-language basis by choosing the language that is mis-assigned in the Advanced Character Formatting  section for the Find Format settings and then choosing the correct language in the Change Formatting section. For that you don't need to enter anything at all in either the find or change fileds in the dialog. Te assign a single language to all the text in a file, regardless of how many languages may be in use, enter .+ in the GREP find field, then set the language of your choice in the change Formatting as above. As long as something is entered into the Change Formatting section, you can leave the change field itself blank.  Although the text won't change when you reassign a language, if may reflow. This is due to different hyphenation rules among the various languages.
    Though we often suggest replacing preferences here when things misbehave, this is one situation where it may actually make things worse. If you set a custom language different from your localization, resetting the prefs would remove that special language and you'll have to re-enter it manually.

  • Even more about deleting the first word in a string

    hi, i have this code that removes the first word in a string, returns the shorter string, removes the first word from the shorter string aso... what i would like it to do is to stop when it hits a non-character, but i can't get it to do that. does anyone know why \b won't work?
    import java.io.*;
    class Testar {
    public static void main(String[] args) {
          String partDesc = "Hi my name is SandraPandra.";
          while (partDesc.equals("\b") == false) {  //this is where something goes wrong
              System.out.println(partDesc);
              partDesc = partDesc.replaceFirst("^(\\w+)\\s+","");
    } thanx in advance!

      while (partDesc.equals("\b") == false) That compares partDesc to a string consisting of one backspace character. I suspect you're trying to use the regex word-boundary anchor, but that's a dead end. If you want to stop beheading the string when the regex stops matching, you can write the code exactly that way: class Testar {
      public static void main(String[] args) {
        String partDesc = "Hi my name is SandraPandra.";
        while ( partDesc.matches("^(\\w+)\\s+.*") ) {
          partDesc = partDesc.replaceFirst("^(\\w+)\\s+","");
          System.out.println(partDesc);
    } If performance is a concern, you can use a pre-compiled Pattern object for greater efficiency. Thanks to Matcher's lookingAt() method, you can use the same regex for the test and the replacement: class Testar {
      public static void main(String[] args) {
        String partDesc = "Hi my name is SandraPandra.";
        Pattern p = Pattern p = Pattern.compile("^(\\w+)\\s+");
        Matcher m = p.matcher(partDesc);
        while ( m.lookingAt() ) {
          partDesc = m.replaceFirst("");
          System.out.println(partDesc);
          m.reset(partDesc);
    } The ^ anchor isn't really necessary in this version, since lookingAt() implicitly anchors the match to the beginning of the string, but you might as well leave it in.

  • Copy/Paste Dropping First Character

    The first character is dropped every time I copy and paste a block of text in Word (2008) and Photoshop CS6, but strangely not in my email client or Google Docs. I am using an iMac running OS 10.9.5. Has anyone else ever encountered this, or does anyone have any suggestions for a remedy? Thanks!

    http://forums.adobe.com/message/4248993

Maybe you are looking for