Archive for May, 2007

.Net Replacement for PHP’s str_replace 

Here is a quick and dirty function that I grabbed from ( http://support.microsoft.com/kb/251354/ ). It does a nice job of replacing PHP’s convenient str_replace.
Private Function str_replace(ByVal strSource As String, _
ByVal strSearchFor As String, ByVal strReplace As String) As String
Dim lngPointer As Long, strNew As String
lngPointer = InStr(strSource, strSearchFor)
If lngPointer = 0 Then
ReplaceEntXMLSpecChar = strSource
Else
strNew […]

Time and Date Formatting in .Net 

I always find myself hunting for a quick reference on formatting various strings, including time and dates in .Net.  Here is a great reference.
.NET Format String 102: DateTime Format String
http://blogs.msdn.com/kathykam/archive/2006/09/29/773041.aspxÂ