wrote:
> Hi
>
> I got a string as follows
>
> str=
> -0.1400,0.2910,-0.2742,-0.2904,0.1087,0.0323,-0.1355,-0.1221,-0.2164,-0.2128#0.0834,-0.4026,-0.2563,-0.0145,-0.3120,-0.2324,-0.1320,-0.0246,-0.1383,-0.1964#0.0711,-0.1743,-0.0128,0.0122,-0.1154,-0.1392,-0.1910,0.0543,-0.0450,-0.0685
>
>
> i need a code in asp so the output is in the following format
>
>
> -0.1400,0.0834,0.0711#0.2910,-0.4026,-0.1743#-0.2742,-0.2563,-0.0128#-0.2904,-0.0145,0.0122#0.1087,-0.3120,-0.1154#0.0323,-0.2324,-0.1392#-0.1355,-0.1320,-0.1910#
> -0.1221,-0.0246,0.0543#-0.2164,-0.1383,-0.0450#-0.2128,-0.1964,-0.0685
>
>
> please help
>
> Regards
> kalyan kamesh
Here you go:
<%
str =
"-0.1400,0.2910,-0.2742,-0.2904,0.1087,0.0323,-0.1355,-0.1221,-0.2164,-0.2128#0.0834,-0.4026,-0.2563,-0.0145,-0.3120,-0.2324,-0.1320,-0.0246,-0.1383,-0.1964#0.0711,-0.1743,-0.0128,0.0122,-0.1154,-0.1392,-0.1910,0.0543,-0.0450,-0.0685"
splitstr = split(str,"#")
firstarr = split(splitstr(0),",")
secondarr = split(splitstr(1),",")
thirdarr = split(splitstr(2),",")
newstr = ""
for i = 0 to ubound(firstarr)
newstr = newstr & firstarr(i) & "," & secondarr(i) & "," & thirdarr(i)
& "#"
next
response.write left(newstr,len(newstr)-1)
%>
--
Mike Brind