I suppose this VB6 code from Daan Davidsz doesn't truly elicit the "WTF" reaction from me. No, it was more the adjective choice that made me chuckle. I mean, I could see describing a function that did a simple character replacement as "handy," "useful," or "helpful." But "ingenious"?

Private Sub DBox(sTekst)
'=========================================================
' Because I hate to write " & vbCrLf & " all the time
' I have made this ingenious function
' Now I can just use the _ character as a NewLine
'=========================================================
    sTekst = Replace(sTekst, "_", vbCrLf)
    MsgBox sTekst, vbOKOnly, "Message"
End Sub

Of course, that in and of itself makes a bit of a weak post, so here's some code from Or M. that shows us the importance of the Double Trim. You know, because you never know if Trim() will actually trim both upper- and lower-case whitespace. The Trim(),Lower(),Trim() will ensure that you'll get it all ...

if (as_tableName.Trim().ToLower().Trim().Equals(ms_srcTable.Trim().ToLower().Trim()))
{
  valid = true;
}
else
{
  valid = false;
}

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!