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. Delimiting character in QString.readLine()
Qt 6.11 is out! See what's new in the release blog

Delimiting character in QString.readLine()

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 8.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    @istream& getline (char* s, streamsize n, char delim );@

    How can I use a delimiting character as argument when dealing with QStrings?
    readLine() only takes maximum allowed line length as argument so I have to walk around?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Sorry for my poor English, I do not understand what you want to express. what is QString.readLine() ?

      Debao

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuldeR
        wrote on last edited by
        #3

        I think that QString does not have a readLine() method.

        The QTextStream class does have a readLine() method which returns a QString.

        It will read one line from the stream. The end of the line can be any of these:

        • The maximum number of characters has been read
        • A line break has been encountered
        • The end of the stream (file) has been reached

        If you want to split a QString with user-defined delimiters, use QString::split() instead ;)

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Yes, split() is indeed the function I am looking for, thanks!

          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