U
unba1300
Guest
This works, but I know there must be a better way. Maybe using Type somehow?
B4X:
'-------------------------------------------------------------------------
'Returns 'a' or 'an' depending on if the passed string starts with a vowel.
'-------------------------------------------------------------------------
Sub DetermineAorAn (et As String) As String
If et.CharAt(0) = "a" OR et.CharAt(0) = "e" OR et.CharAt(0) = "i" OR _
et.CharAt(0) = "o" OR et.CharAt(0) = "u" OR et.CharAt(0) = "A" OR _
et.CharAt(0) = "E" OR et.CharAt(0) = "I" OR et.CharAt(0) = "O" OR _ et.CharAt(0) = "U" Then
Return "an "
Else
Return "a "
End If
End Sub