Well, the question is a little bit vague. You don’t specify the casing. If the method should be case sensitive, than here is the method:
Code:
'Case sensitive
Private Function ContainsDuplicate(ByRef str As String) As Boolean
For i As Integer = 0 To str.Length - 1
If str.Substring(0, i).Contains(str.Substring(i, 1)) Then
Return True
End If
Next
Return False
End Function
If it is not spouse to be case sensitive, than add ToLower method after str and leave the rest the same, here is an example:
Code:
'None case sensitive
Private Function ContainsDuplicate(ByRef str As String) As Boolean
For i As Integer = 0 To str.Length - 1
If str.ToLower.Substring(0, i).Contains(str.ToLower.Substring(i, 1)) Then
Return True
End If
Next
Return False
End Function