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. (Solved)QString print strange value
Forum Updated to NodeBB v4.3 + New Features

(Solved)QString print strange value

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 1.7k Views
  • 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.
  • H Offline
    H Offline
    haris123
    wrote on last edited by haris123
    #1

    I am trying to print the QString using qDebug() but I am getting strange value printed.

        QString c = QString("​command");
        qDebug()<<c;
    

    Which print

        "\u200Bcommand"
    

    on the console, what could be the reason.

    jsulmJ J.HilkJ 2 Replies Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Do u have only this qdebug in your qt program ? Check this print is coming from previous qdebug. Which platform?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      4
      • H haris123

        I am trying to print the QString using qDebug() but I am getting strange value printed.

            QString c = QString("​command");
            qDebug()<<c;
        

        Which print

            "\u200Bcommand"
        

        on the console, what could be the reason.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @haris123 I would delete the "command" string in the editor and enter it again. You probably entered a Unicode character accidentally (\u200 is something like a space as far as I know).

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        4
        • H haris123

          I am trying to print the QString using qDebug() but I am getting strange value printed.

              QString c = QString("​command");
              qDebug()<<c;
          

          Which print

              "\u200Bcommand"
          

          on the console, what could be the reason.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @haris123 @jsulm is right, \u200B is Unicode Character 'ZERO WIDTH SPACE' so it's probably not displayed in QtCreator.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          3
          • H Offline
            H Offline
            haris123
            wrote on last edited by
            #5

            Yes in that case it's work when I delete the string and type again, thanks for the feedback.

            1 Reply Last reply
            0

            • Login

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