[TEST] of code highlighter

Page 1 of 1

1 Replies - 1223 Views - Last Post: 03 April 2013 - 08:18 AM Rate Topic: -----

#1 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2268
  • View blog
  • Posts: 9,482
  • Joined: 29-May 08

[TEST] of code highlighter

Posted 03 April 2013 - 08:08 AM

Test code:- I'd be very surprise if this renders correctly

Namespace AdamSpeight2008
Public Module Testing
 
Public Sub Test()
  REM A comment
  Dim i As Integer = 42
  ' Also Comment
  Dim s As String = " This ain't a comment"
End Sub

  ' Attribute
  <Extension>
  Public Function NonWhiteSpaceCount(s As String) As Integer
    Return s.Where(Function(c) Not Char.IsWhiteSpace(c)).Count()
  End Function

  <Extension>
  Function CountNonWhiteSpace_Linq(ByVal s As string) As Integer
    Return Aggregate  c In s
           Where Not Char.IsWhiteSpace(c) 
           Into Count
  End Function

 Dim x As Xml.Linq.XElement = <TimeNode>
                             <Time Value=<%= Now.TimeOfDay  %> ></Time>
                           </TimeNode>
  Dim xt As String() = x.<Time>.Where(Function( xe) xe.@Value="12:00.00").Select(Function(x) x.@Value ).ToArray 

  Public Function Test2() As String
    Return "A Test String"
  End Function
  
  ' XML Literal
  Dim x2 = <test>
            <node a1="1">
            </node>
          </test>

  Public Sub Test3()
    For i = 1 To 10
      Console.WriteLine(i)
    Next
    For i = 10 To 1 Step -1
      If i = 4 Then
         Console.Write("Four:")
      ElseIf i=5 Then
         Console.Write("Five:")
      Else
         Console.Write("----:")
      End If
      Console.WriteLine(i)

    Next i
    For Each xx In {1,2,3,4,5}
      Console.WriteLine(xx)
    Next

    Dim ii=0
    While i < 10
      Console.WriteLine("Hello World!")
      i += 1
    End While
    Do
      i = i - 1
      Console.WriteLine("Do Loop Until Test")
    Loop Until i =0
    Do
      i = i + 1
      Console.WriteLine("Do Loop While Test")
    Loop While i < 10

    Dim ts = 10
    Select Case ts
      Case Is < 0 : Console.WriteLine("LessThan 0")
      Case 0,1 : Console.WriteLine("Case 2")
      Case 2 To 4: Console.WriteLine("Case 3")
      Case Else
        Console.WriteLine("Case Else")
    End Select
      
  End Sub

  Public Iterator Function OneToTen() As IEnumerable(Of Integer)
    For i = 1 To 10
      Yield i
    Next
  End Function
  
  Public Function TenToOne() As IEnumerable(Of Integer)
    Return Iteration Function()
             Dim i=10
             While i>0
               Yield i
               i -= 1
             End While
           End Function
   End Function
End Module
End Namespace


I think that covers most of the stuff

This post has been edited by AdamSpeight2008: 03 April 2013 - 08:29 AM
Reason for edit:: Helps if I spell the Keywords correctly. DOH!


Is This A Good Question/Topic? 0
  • +

Replies To: [TEST] of code highlighter

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: [TEST] of code highlighter

Posted 03 April 2013 - 08:18 AM

Worked for me, but since it's loading Javascript after the page loads, it takes a good 10 seconds or so.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1