#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    11
    Rep Power
    0

    Question split() function


    I have a textarea and i have to enter a list of tickers like below.....

    sss,ffff,gggg,ttttt

    (here the count is 4)
    then later they have to be written on a file.

    the thing is.....

    if i have a record something like below....

    sss,,fffff, ,gggg,tttttt,


    then i have to remove the spaces,extra commas and it should return the count as 4.
    if i use split function for the above record , i get the o/p count 6 which is not i watned.

    i do i solve the above thing using split??

    is there any other method???

    Thanks in advance.
    Kalpana
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,473
    Rep Power
    15
    You could check each substring returned by split() and if it's a space, you could not count it or not write it to a file.

IMN logo majestic logo threadwatch logo seochat tools logo