Monday, April 17, 2006

 

Case Changer Excluding Literals

This VB.NET function should change the case of strings excluding literals (e.g. like a string within quotes, or double-quotes). You can choose the case and what character should be the literal/text identifier.

Usage:
Dim x as string
x = "I like to 'Eat','EAT','eat', Apples and Bananas."
x = CaseChangeExcludingLiterals(x,True,"'")

x now equals: "I LIKE TO 'Eat','EAT','eat',APPLES AND BANANAS."

Private Function CaseChangerExcludingLiterals(ByVal Source As String, Optional ByValAs Boolean = True, Optional ByVal LiteralIdentifier As Char = Chr(34)) As String ToUpper


Dim SourceReturn As String = ""

Dim InsideQuotes As Boolean = False

For Each SourceCharacter As Char In Source

If SourceCharacter = LiteralIdentifier Then

SourceReturn &= SourceCharacter

If InsideQuotes Then

InsideQuotes = False

Else

InsideQuotes = True

End If

Else

If InsideQuotes Then

SourceReturn &= SourceCharacter

Else

If ToUpper Then

SourceReturn &= Char.ToUpper(SourceCharacter)

Else

SourceReturn &= Char.ToLower(SourceCharacter)

End If

End If

End If

Next

Return SourceReturn

End Function


Thursday, April 06, 2006

 

Learning ASP.NET 2 w/ATLAS Adventure

Are you an old timer like me who wants to learn ASP.NET 2.0?  I have been logging my "Learn ASP.NET 2.0 w/ATLAS" adventure at:

http://www.zohoplanner.com/organizer/public/publicpage.jsp?PageId=12989

Perhaps my struggles may come in handy.  Feel free to take a look.  I have provided links to a lot of resources I used (and am still using).

This page is powered by Blogger. Isn't yours?