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.indexOf ( "",""); ??
Forum Updated to NodeBB v4.3 + New Features

QString.indexOf ( "",""); ??

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 407 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.
  • W Offline
    W Offline
    Woeps
    wrote on last edited by
    #1

    Hi..

    How to search these three characters "," in a QString ?

    int t = line.indexOf( "","" );

    Does not work..

    Thanks..

    M 1 Reply Last reply
    0
    • W Woeps

      Hi..

      How to search these three characters "," in a QString ?

      int t = line.indexOf( "","" );

      Does not work..

      Thanks..

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2
      "\",\""  
      
      1 Reply Last reply
      2
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi, welcome to the forum.
        " marks a beginning and end of a string. To use it as a character you have to escape it with \:

        int t = line.indexOf( "\",\"" );
        

        or you can use a raw string literal, which is delimited by R"( and )" like this:

        int t = line.indexOf( R"(",")" );
        

        but this one is better for longer or more complicated strings.

        1 Reply Last reply
        2
        • W Offline
          W Offline
          Woeps
          wrote on last edited by
          #4

          Works :-)

          Thank you very much.

          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