Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ToUpper and ToLower part of a string in .net C++?

ToUpper and ToLower part of a string in .net C++?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestioncsharpc++help
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TabascoSauce
    wrote on last edited by
    #1

    Thanks for looking at my question, I am wondering how I would use the ToUpper and ToLower functions on only part of a string in .net C++. For example, I converted an inputted name to all caps for the purpose of comparing it. Now I need to display the name with only the first letter capitalized. In short, I need to make "BRAD" to "Brad" Note that the inputted name is not always the same, so however you can show me how to do this has to work with any inputted name. Thanks for any help!!

    S 1 Reply Last reply
    0
    • T TabascoSauce

      Thanks for looking at my question, I am wondering how I would use the ToUpper and ToLower functions on only part of a string in .net C++. For example, I converted an inputted name to all caps for the purpose of comparing it. Now I need to display the name with only the first letter capitalized. In short, I need to make "BRAD" to "Brad" Note that the inputted name is not always the same, so however you can show me how to do this has to work with any inputted name. Thanks for any help!!

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      TabascoSauce wrote:

      .net C++

      Are you talking about the C++ that uses System::String? If so, there's a forum[^] just for that variant of C++ (and it's not this one). In general, though, you'd identify the sub-string that you want to convert, extract if from the string, convert it and then re-insert it into the string. HTH! [edit]In MFC, I'd do it like this:

      CString CapitaliseName(CString const& upperCaseName)
      {
      return upperCaseName.Left(1) + upperCaseName.Mid(1).MakeLower();
      }

      [/edit]

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      T 1 Reply Last reply
      0
      • S Stuart Dootson

        TabascoSauce wrote:

        .net C++

        Are you talking about the C++ that uses System::String? If so, there's a forum[^] just for that variant of C++ (and it's not this one). In general, though, you'd identify the sub-string that you want to convert, extract if from the string, convert it and then re-insert it into the string. HTH! [edit]In MFC, I'd do it like this:

        CString CapitaliseName(CString const& upperCaseName)
        {
        return upperCaseName.Left(1) + upperCaseName.Mid(1).MakeLower();
        }

        [/edit]

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        T Offline
        T Offline
        TabascoSauce
        wrote on last edited by
        #3

        Thanks for the help, sorry about the wrong forum, I'll repost there.

        S 1 Reply Last reply
        0
        • T TabascoSauce

          Thanks for the help, sorry about the wrong forum, I'll repost there.

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          TabascoSauce wrote:

          sorry about the wrong forum

          No problem - BTW - have a look at the System::String docs - I have a feeling you'll find the same methods on that as I used on the MFC CString class....

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups