Link to home
Start Free TrialLog in
Avatar of sasha85
sasha85

asked on

split? left? right?

i got rs("x") with lots of numbers divided with comma(,)
*ends with comma too
3434,4343,5456,676556565,65,

how i can print them with space between them?
like this:(and to kill the last comma)
3434 ,4343 ,5456 ,676556565 ,65 ,
SOLUTION
Avatar of Bob Butcher
Bob Butcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85
sasha85

ASKER

deathtospam ,i understand samic400 solution...
i am kind of lost with yours:

strValues = Trim(rs("x") & "") ?
      sValue = Trim(arrValues(iIndex)) ?
SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85

ASKER

well that's what i'm talking about...replace function is great!:)
hielo, how are you?:)
i understand deathtospam's code now but,
what do you think about deathtospam's code?
i mean what is better-to replace from the begining or processing the rs("x") as deathtospam did...
>>...replace function is great!:)
It sure is

>>hielo, how are you?:)
Super

>>what is better-to replace from the begining or processing the rs("x") as deathtospam did
I find the "Replace" option easier to understand/maintain. If the rs("x") values is "consistent" , processing the other way is kind of an overkill, espcially since it saves the value of Split every time it is called. The way I see it, don't consume extra memory resources if it is not needed.
Avatar of sasha85

ASKER

Replace( Left( rs("x"),Len(rs("x"))-1 ), ",", " ,")
runs on the all rs("x")
or i still need to split and replace every part?
>>or i still need to split and replace every part?
No Splitting necessary. I am assuming rs("x") is some db field. As an example, you would use it as follows:

'assuming you queried the db and the result is in rs
while Not rs.eof
 Response.Write Replace( Left( rs("x"),Len(rs("x"))-1 ), ",", " ,")
rs.moveNext
wend
Avatar of sasha85

ASKER

i just tried that...i got plain page...
my rs("x") was 232,343445,565656,35324,2432,
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sasha85

ASKER

aa ok...my mistake...

thank you!