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. Managed C++/CLI
  4. String.Split - tutorial? samples?

String.Split - tutorial? samples?

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++helptutorialquestion
3 Posts 2 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.
  • L Offline
    L Offline
    LudwigKeck
    wrote on last edited by
    #1

    Can someone please direct me to a tutorial and/or samples on the use of the String.Split method? (I seem to have problems translating C# help info for use with C++.) LudwigKeck

    B 1 Reply Last reply
    0
    • L LudwigKeck

      Can someone please direct me to a tutorial and/or samples on the use of the String.Split method? (I seem to have problems translating C# help info for use with C++.) LudwigKeck

      B Offline
      B Offline
      baerten
      wrote on last edited by
      #2

      String *limiter = S","; // --> The Limiter will be , Char delimiter[] = limiter->ToCharArray(); // --> Split-Method awaites a Char-Array String* parts[] = 0; // --> Receives all parts parts = line->Split(delimiter); if line is "one,two,three" so the parts are part[0] = "one" part[1] = "two" part[2] = "three" The answer is very late, but i'm a newbie @ Code-Project ( since yesterday ) Regards

      L 1 Reply Last reply
      0
      • B baerten

        String *limiter = S","; // --> The Limiter will be , Char delimiter[] = limiter->ToCharArray(); // --> Split-Method awaites a Char-Array String* parts[] = 0; // --> Receives all parts parts = line->Split(delimiter); if line is "one,two,three" so the parts are part[0] = "one" part[1] = "two" part[2] = "three" The answer is very late, but i'm a newbie @ Code-Project ( since yesterday ) Regards

        L Offline
        L Offline
        LudwigKeck
        wrote on last edited by
        #3

        Thank you Baerten, My problem was in C++, the code you show is C#. I have since worked it out the hard way (never did find any good documentation). In C++ the correct use is: String^ data = "one,two,three"; array<>^ separator = {','}; array<>^ parts; parts = data->Split (separator); As you can see, C++ syntax is just a bit opaque, (there should be just single arrow symbols where I show double). The module using this works fine for me now. However, now it causes a memory corruption in old legacy code that has worked for years. --- I'm not even sure how to describe it to forma help question. Such is life. Thank you again, and welcome to the world inside!!

        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