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. QString startsWith (")

QString startsWith (")

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

    Hello guys ,
    i want to test if a QString start with the character (") return true else return false , i tried startsWith(""") but it didn't work
    for exemple "Hello World" ==true (it starts with the character " )
    Hello World" ==false (it didn't start with the character " )

    Thanks guys

    my english is average, please use simple words and try to be the most explicit, thank you

    JonBJ KroMignonK 2 Replies Last reply
    0
    • Z Zunneh

      Hello guys ,
      i want to test if a QString start with the character (") return true else return false , i tried startsWith(""") but it didn't work
      for exemple "Hello World" ==true (it starts with the character " )
      Hello World" ==false (it didn't start with the character " )

      Thanks guys

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Zunneh
      What did you actually try? Copying from what you have written:

      startsWith(""") 
      

      won't compile in C++, so it can't be that....

      Did you try startsWith("\"") ?

      1 Reply Last reply
      2
      • Z Zunneh

        Hello guys ,
        i want to test if a QString start with the character (") return true else return false , i tried startsWith(""") but it didn't work
        for exemple "Hello World" ==true (it starts with the character " )
        Hello World" ==false (it didn't start with the character " )

        Thanks guys

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #3

        @Zunneh

        QString myTest("\"Hello Wolrd");
        
        if (myTest.indexOf(QChar('"')) == 0)
        {
             // starts with double quote
        }
        

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        1 Reply Last reply
        4
        • Z Offline
          Z Offline
          Zunneh
          wrote on last edited by Zunneh
          #4

          Thank you guys , the two solutions works perfectly ('"') or ("\n")

          my english is average, please use simple words and try to be the most explicit, thank you

          Pablo J. RoginaP 1 Reply Last reply
          1
          • Z Zunneh

            Thank you guys , the two solutions works perfectly ('"') or ("\n")

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @Zunneh if your issue is solved, please don't forget to mark your post as such. Thanks.

            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
            0

            • Login

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