Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
7 Posts 4 Posters 0 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.
  • M Offline
    M Offline
    mitko5
    wrote on last edited by
    #1

    [Message Deleted]

    A A G 3 Replies Last reply
    0
    • M mitko5

      [Message Deleted]

      A Offline
      A Offline
      albCode
      wrote on last edited by
      #2

      rTB2.Clear(); int i = 0; string s = rTB1.Text; string substr = ""; switch(rTB1.Text) { case '"': { while (i < s.Length && s[i]!='"' && s[i]!='\n') { substr += s[i]; i++; } rTB2.Text += "String - " + substr + "\n"; substr = ""; }break; }

      M 1 Reply Last reply
      0
      • M mitko5

        [Message Deleted]

        A Offline
        A Offline
        AB7771
        wrote on last edited by
        #3

        a very simple method is to get the first index of " (opening quotes) and then get the next index of the " (closing quotes) and the get the substring within those indices Regards, Pramod

        M 1 Reply Last reply
        0
        • A albCode

          rTB2.Clear(); int i = 0; string s = rTB1.Text; string substr = ""; switch(rTB1.Text) { case '"': { while (i < s.Length && s[i]!='"' && s[i]!='\n') { substr += s[i]; i++; } rTB2.Text += "String - " + substr + "\n"; substr = ""; }break; }

          M Offline
          M Offline
          mitko5
          wrote on last edited by
          #4

          This is my code. If you see s = rTB1.Text. So you simply rewrite my code. If you can, please help :)

          1 Reply Last reply
          0
          • A AB7771

            a very simple method is to get the first index of " (opening quotes) and then get the next index of the " (closing quotes) and the get the substring within those indices Regards, Pramod

            M Offline
            M Offline
            mitko5
            wrote on last edited by
            #5

            I guess You are right, but I mess up something so i could not use that way of solving the problem. If you could give me an example, will be appreciated. Regards, Mitko -- modified at 5:29 Tuesday 7th March, 2006

            A 1 Reply Last reply
            0
            • M mitko5

              I guess You are right, but I mess up something so i could not use that way of solving the problem. If you could give me an example, will be appreciated. Regards, Mitko -- modified at 5:29 Tuesday 7th March, 2006

              A Offline
              A Offline
              AB7771
              wrote on last edited by
              #6

              try this one if(richTextBox1.Text != "") { string str1 = richTextBox1.Text; int i= str1.IndexOf('\"'); int j = str1.IndexOf('\"',i+1); string str2 = str1.Substring(i+1,j-i-1); richTextBox2.Text = str2; } Regards, Pramod

              1 Reply Last reply
              0
              • M mitko5

                [Message Deleted]

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                You could use a regular expression to parse the string. Using a pattern like "([A-Za-z]+|\"[A-Za-z ]+?\")" would capture all "identificators" and quoted phrases in the string. --- b { font-weight: normal; }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups