SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parsing VB script line feed

    Hello,
    Am have a slight problem parsing a request.form object results for VB Script line feeds.

    PROBLEM:
    If i put numbers in a textbox seperated by a comma e.g. 2452452,42542542,24524524 once i retrieve and iterate through the results set i can easily parse them. Using the split funtion and checking through each value in an array

    e.g.

    Code:
    numbers = request.form("results")
    split(numbers)
    total = ubound(numbers)
    
    for i = 0 to total
    response.write(numbers(i))
    next
    However, when i use a line feed. e.g.

    45245245,
    25254254,
    254254254

    The result set adds a space before the number(i) value

    I have tried using both replace and trim function, to remove the space, but it appears the space is a server encode character.

    I tried using the server.HTMLEncode(number(i)) to see what the value is, but nothing is written.

    PROBLEM
    The result set no longer is a numeric value. How do i solve this ?

    QUITE COMPLEX

    Any ideas, thanks

    Afrika

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Instead of
    split(numbers)

    use
    split(numbers, "," & vbCrLf)

    Remember that the Split function takes more than one parameter.
    Split(expression[, delimiter[, count[, compare]]])

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jim,
    excellent !!!!

    I even got another way of achieving it.

    check(i) = (REPLACE(CSTR(check(i)), CHR(13), ""))
    check(i) = (REPLACE(CSTR(check(i)), CHR(10), ""))


    The value of vbCrLf is Chr(13) &Chr(10)

    have a great day

    Ehi

  4. #4
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I also used
    check(i) = (REPLACE(CSTR(check(i)), vbCrLf, ""))


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •