CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    35

    Replace character at a particular position

    Code:
    function ConvertToUpperCase()
                {
                var result;
                var numaric = "sonia";
                var Character = numaric.charAt(0);
                result=Character.toUpperCase(); 
                  //In Result char is coming in UpperCase
                  //I want how to replace the charater at postion 0 in numaric with result
                }

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Replace character at a particular position

    Are you just trying to make the first letter capitalized? If so, you're making it way too hard on yourself.

    Code:
    function ConvertToUpperCase(str) {
      var tmp = str.charAt(0).toUpperCase();
      return tmp + str.substr(1);
    }
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured