Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. AnsiString equivalent in qt
Forum Updated to NodeBB v4.3 + New Features

AnsiString equivalent in qt

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 4 Posters 1.5k Views 2 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.
  • James SprinksJ Offline
    James SprinksJ Offline
    James Sprinks
    wrote on last edited by
    #1

    Hi All

    I am re-writing some old C++ Builder code into Qt, and have come across a variable type:

    AnsiString m_name;
    

    From what I gather it is a form of 'long string', can anyone help me out with what the equivalent is in Qt?

    Thanks

    J

    1 Reply Last reply
    0
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @James-Sprinks could you provide some more context about how this variable is used, i.e. what values is assigned, how is employed in your code?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        If you are referring to this class then QString works and uses UTF8. If you rely on the fact that it will use the system encoding method then restrict interations with it to use QTextStream.

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        2
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          QString will do anything you are used to AnsiString does. ( it seems so far)
          The only surprise is that
          int val=10;
          QString test ="val = " + val;
          Does NOT give you "Val =10" as AnsiString would.
          In Qt that is
          QString test ="val = " + QString::number(val);

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved