output format

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kalikoi@gmail.com

    output format

    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

  • Mike Brind

    #2
    Re: output format


    kalikoi@gmail.c om wrote:[color=blue]
    > 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[/color]

    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

    Comment

    • kalikoi@gmail.com

      #3
      Re: output format

      Mike Brind wrote:[color=blue]
      > kalikoi@gmail.c om wrote:[color=green]
      > > 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[/color]
      >
      > 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[/color]


      Hi Mike

      Thanks for response
      but my series in str is dynamic...what should i do in that case

      Regards
      kalyan

      Comment

      • Mike Brind

        #4
        Re: output format


        kali...@gmail.c om wrote:[color=blue]
        > Mike Brind wrote:[color=green]
        > > kalikoi@gmail.c om wrote:[color=darkred]
        > > > 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[/color]
        > >
        > > 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[/color]
        >
        >
        > Hi Mike
        >
        > Thanks for response
        > but my series in str is dynamic...what should i do in that case
        >
        > Regards
        > kalyan[/color]

        The example you gave shows three sets of 10 values delimited by #.
        Each of the values within each set is delimited by a comma. Which
        part(s) are dynamic? The number of sets? The number of values? Are
        the number of values always the same regardless of the number of sets?
        Will the number of values change between sets?

        --
        Mike Brind

        Comment

        • kalikoi@gmail.com

          #5
          Re: output format

          Mike

          The number of sets are dynamic...each set has exactly 10 values all the
          time separated by comma

          Kalyan kamesh

          Comment

          • Mike Brind

            #6
            Re: output format

            kali...@gmail.c om wrote:[color=blue]
            > Mike Brind wrote:[color=green]
            > > kali...@gmail.c om wrote:[color=darkred]
            > > > Hi[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > I got a string as follows[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > 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[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > i need a code in asp so the output is in the following format[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > -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[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > please help[/color][/color][/color]
            [color=blue][color=green][color=darkred]
            > > > Regards
            > > > kalyan kamesh[/color][/color][/color]
            [color=blue][color=green]
            > > Here you go:[/color][/color]
            [color=blue][color=green]
            > > <%
            > > 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"[/color][/color]
            [color=blue][color=green]
            > > splitstr = split(str,"#")[/color][/color]
            [color=blue][color=green]
            > > 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)
            > > %>[/color][/color]
            [color=blue][color=green]
            > > --
            > > Mike Brind[/color][/color]
            [color=blue]
            > Hi Mike[/color]
            [color=blue]
            > Thanks for response
            > but my series in str is dynamic...what should i do in that case[/color]
            [color=blue]
            > Regards
            > kalyan[/color]
            [color=blue]
            >The example you gave shows three sets of 10 values delimited by #.
            >Each of the values within each set is delimited by a comma. Which
            >part(s) are dynamic? The number of sets? The number of values? Are
            >the number of values always the same regardless of the number of sets?
            >Will the number of values change between sets?[/color]
            [color=blue]
            >--
            >Mike Brind
            >kalikoi@gmail. com wrote:
            > Mike
            >
            > The number of sets are dynamic...each set has exactly 10 values all the
            > time separated by comma
            >
            > Kalyan kamesh[/color]

            First off, please don't use the reply link at the bottom of the post in
            google groups - it wipes out what you are replying to. Use the Reply
            link that is revealed when you click Show Options next to a poster's
            name. Loads of poster's get caught out with that. Google really ought
            to sort their interface out :-)

            Back to your question - you need to read them into a 2 d array, then
            read then back out in the order that you want. This should do it:

            splitstr = split(str,"#")
            cols=9
            rows=ubound(spl itstr)

            dim myarray()
            redim myarray(cols,ro ws)

            for y = 0 to rows
            arr = split(splitstr( y),",")
            for x = 0 to cols
            myarray(x,y) = arr(x)
            next
            next
            newstr = ""
            for i = 0 to cols
            for j = 0 to rows
            newstr = newstr & myarray(i,j)
            if j = rows then
            newstr=newstr
            else
            newstr = newstr & ","
            end if
            next
            newstr = newstr & "#"
            next
            response.write left(newstr,len (newstr)-1)
            %>

            --
            Mike Brind

            Comment

            • kalikoi@gmail.com

              #7
              Re: output format


              Mike Brind wrote:[color=blue]
              > kali...@gmail.c om wrote:[color=green]
              > > Mike Brind wrote:[color=darkred]
              > > > kali...@gmail.c om wrote:
              > > > > Hi[/color][/color]
              >[color=green][color=darkred]
              > > > > I got a string as follows[/color][/color]
              >[color=green][color=darkred]
              > > > > 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[/color][/color]
              >[color=green][color=darkred]
              > > > > i need a code in asp so the output is in the following format[/color][/color]
              >[color=green][color=darkred]
              > > > > -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[/color][/color]
              >[color=green][color=darkred]
              > > > > please help[/color][/color]
              >[color=green][color=darkred]
              > > > > Regards
              > > > > kalyan kamesh[/color][/color]
              >[color=green][color=darkred]
              > > > Here you go:[/color][/color]
              >[color=green][color=darkred]
              > > > <%
              > > > 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"[/color][/color]
              >[color=green][color=darkred]
              > > > splitstr = split(str,"#")[/color][/color]
              >[color=green][color=darkred]
              > > > 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)
              > > > %>[/color][/color]
              >[color=green][color=darkred]
              > > > --
              > > > Mike Brind[/color][/color]
              >[color=green]
              > > Hi Mike[/color]
              >[color=green]
              > > Thanks for response
              > > but my series in str is dynamic...what should i do in that case[/color]
              >[color=green]
              > > Regards
              > > kalyan[/color]
              >[color=green]
              > >The example you gave shows three sets of 10 values delimited by #.
              > >Each of the values within each set is delimited by a comma. Which
              > >part(s) are dynamic? The number of sets? The number of values? Are
              > >the number of values always the same regardless of the number of sets?
              > >Will the number of values change between sets?[/color]
              >[color=green]
              > >--
              > >Mike Brind
              > >kalikoi@gmail. com wrote:
              > > Mike
              > >
              > > The number of sets are dynamic...each set has exactly 10 values all the
              > > time separated by comma
              > >
              > > Kalyan kamesh[/color]
              >
              > First off, please don't use the reply link at the bottom of the post in
              > google groups - it wipes out what you are replying to. Use the Reply
              > link that is revealed when you click Show Options next to a poster's
              > name. Loads of poster's get caught out with that. Google really ought
              > to sort their interface out :-)
              >
              > Back to your question - you need to read them into a 2 d array, then
              > read then back out in the order that you want. This should do it:
              >
              > splitstr = split(str,"#")
              > cols=9
              > rows=ubound(spl itstr)
              >
              > dim myarray()
              > redim myarray(cols,ro ws)
              >
              > for y = 0 to rows
              > arr = split(splitstr( y),",")
              > for x = 0 to cols
              > myarray(x,y) = arr(x)
              > next
              > next
              > newstr = ""
              > for i = 0 to cols
              > for j = 0 to rows
              > newstr = newstr & myarray(i,j)
              > if j = rows then
              > newstr=newstr
              > else
              > newstr = newstr & ","
              > end if
              > next
              > newstr = newstr & "#"
              > next
              > response.write left(newstr,len (newstr)-1)
              > %>
              >
              > --
              > Mike Brind[/color]


              Thanks Mike it worked great...thanks for u r reply

              Thanks & Regards
              kalyan kamesh

              Comment

              Working...