Results 1 to 10 of 10

Thread: what does {} do in .net? [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    what does {} do in .net? [RESOLVED]

    I am looking at the indexof() and one of the examples shows this:

    Console.WriteLine("All occurrences of 'he' from position {0} to {1}.", start, [end] - 1)
    Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine, br1, br2, str)

    what will the output be?



    here's the full example:
    Code:
    Dim br1 As String = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
          Dim br2 As String = "0123456789012345678901234567890123456789012345678901234567890123456"
          Dim str As String = "Now is the time for all good men to come to the aid of their party."
          Dim start As Integer
          Dim at As Integer
          Dim [end] As Integer
          Dim count As Integer
          
          [end] = str.Length
          start = [end] / 2
          Console.WriteLine()
          Console.WriteLine("All occurrences of 'he' from position {0} to {1}.", start, [end] - 1)
          Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine, br1, br2, str)
          Console.Write("The string 'he' occurs at position(s): ")
          
          count = 0
          at = 0
          While start <= [end] AndAlso at > - 1
             ' start+count must be a position within -str-.
             count = [end] - start
             at = str.IndexOf("he", start, count)
             If at = - 1 Then
                Exit While
             End If
             Console.Write("{0} ", at)
             start = at + 1
          End While
          Console.WriteLine()
    Last edited by Andy; Dec 29th, 2003 at 03:08 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width