01-08-2009, 12:06 PM
Here's a tiny improvement:
using "ass"
using "test"
Test1 was using the original code.
Test2 is:
using "ass"
Quote:%Faster 185.7| 71.4| 71.4| 64.3| 71.4| 64.3| 71.4| 64.3| 84.6| 71.4
Test1 40| 24| 24| 23| 24| 23| 24| 23| 24| 24
Test2 14| 14| 14| 14| 14| 14| 14| 14| 13| 14
using "test"
Quote:%Faster 46.7| 46.7| 64.3| 53.3| 53.3| 33.3| 33.3| 33.3| 53.3| 33.3
Test1 22| 22| 23| 23| 23| 20| 20| 20| 23| 20
Test2 15| 15| 14| 15| 15| 15| 15| 15| 15| 15
Test1 was using the original code.
Test2 is:
Code:
Private Function CheckGrammar(ByVal Word As String, Optional ByVal Caps As Byte = 0) As String
Dim FirstLetter As String * 1
FirstLetter = LCase$(Left$(Word, 1))
If FirstLetter = "$" Then
CheckGrammar = (Mid$(Word, 2, Len(Word) - 1))
Exit Function
End If
If FirstLetter Like "*[aeiou]*" Then
If Caps Then CheckGrammar = "An " & Word Else CheckGrammar = "an " & Word
Else
If Caps Then CheckGrammar = "A " & Word Else CheckGrammar = "a " & Word
End If
End Function