Hi all,
I have been playing around with trying to create an english to pig latin translator.
I am not really sure where to start, so right now I am just focusing on splitting a string and search for "A", if the word has "A" add "way" to the end of it. Here is what I figured out from some reasearch (I found most of this from a post on here):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strComplete As String = TextBox1.Text
Dim strWords() As String
strWords = strComplete.Split(" ")
strWords = strComplete.Split(strSeparators)
TextBox2.Text = String.Join("-", strWords) 'hypen used to tell me string is working.
End Sub
End Class
This works, the problem happens when I try to search the string and manipulate it. I was told to use the startswith command to do the manipulation.
So if I do something like:
If strWords.StartsWith("A") Then
strWords += "-WAY"
End If
It gives me an error that says "StartsWith' is not a member of 'System.Array", but if I do:
If strWords(0).StartsWith("A") Then
strWords(0) += "-WAY"
End If
It works, But I am not sure how to get it so it search the entire string without having to do 1,2,3,ect.
What would be the best way to search the string for certain letters? I was thinking some type of case or loop but I tried a few different things, but could not get it process correctly. Google, gives me alot of different examples, but I can not get most of them working with my code. I only have a semester of VB.net Programming, so I am trying to find the best way to do this, without making it too complicated.
Thanks!