Announcement

Collapse
No announcement yet.

Splitting a String

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Splitting a String

    I need to split a string into two seperate parts like below...

    SplitStr = "a,b;c~d,e;f~g,h;i,j;k~l,m;n"

    new strings:

    "a,b;c~"
    "d,e;f~g,h;i,j;k~l,m;n"

    I think i can do this with string.gmatch and captures but im not sure? Anyone know how this can be achieved simply?

    P.S I have acheived this with a combination of string.find, .length, .left and .right but want a better, more compact method if possible.

    Thanks in advance for any help.

  • #2
    what about string.mid ??

    Comment


    • #3
      plenty of samples on forum, also take a look at following links, found using google button

      http://lua-users.org/wiki/SplitJoin
      http://stackoverflow.com/questions/1...-string-in-lua

      Comment

      Working...
      X