how to array "next line" ?

Discussion in 'C#' started by JJnacy, Jun 21, 2009.

  1. #1
    example text box: one line one product

    book
    food
    car

    question :
    how to array split these three products?


    Thanks
     
    JJnacy, Jun 21, 2009 IP
  2. DoDo Me

    DoDo Me Peon

    Messages:
    2,257
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    VBScript: split(vbCrlf) ,, or vbCr, vbLf
    JScript: split('\n');

    something like this
     
    DoDo Me, Jun 21, 2009 IP
  3. chipimbiri

    chipimbiri Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    dim arr as string()
    arr=split(textfromlist, vbCrLf)
     
    chipimbiri, Jun 22, 2009 IP
    JJnacy likes this.
  4. JJnacy

    JJnacy Peon

    Messages:
    448
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you,

    another problem:

    how to replace two vbCrLf become one vbCrLf

    I have tried these ways but not working.
    replace(stringX,"vbCrLfvbCrLf","vbCrLf")
    replace(stringX,vbCrLfvbCrLf,vbCrLf)

    Please help

    Thanks,
     
    JJnacy, Jun 22, 2009 IP
  5. imageediting

    imageediting Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hii..try this code...

    replace(vbCrLfvbCrLf,vbCrLf)
     
    imageediting, Jun 23, 2009 IP
  6. onlinebookkeeper

    onlinebookkeeper Peon

    Messages:
    73
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hmmm imageediting is right...
    i think this is the simplest best code for replace.
     
    onlinebookkeeper, Jun 24, 2009 IP
  7. dopanel.com

    dopanel.com Peon

    Messages:
    93
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    replace(stringX,vbCrLf & vbCrLf,vbCrLf)
     
    dopanel.com, Jun 24, 2009 IP
  8. DoDo Me

    DoDo Me Peon

    Messages:
    2,257
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you better use regular expression in this kind of replace
     
    DoDo Me, Jun 24, 2009 IP
  9. JJnacy

    JJnacy Peon

    Messages:
    448
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks it works now.
     
    JJnacy, Jun 24, 2009 IP