|
-
Nov 13th, 2000, 11:22 PM
#1
Thread Starter
Lively Member
Hello i have saved all the words from a text field into an array called MyString(). This array has each words saved separatly, so if the text file says "Hello my name is" then the array saves "Hello" and "my" and "name" and "is" in itself. The problem is that I am trying to convert all the words in this array into PIG LATIN: here is what my code looks like:
Make a new function
Function EnglishToPig(EngWord As String) As String
Dim strConvert As String
strConvert = EngWord
strConvert = Right(EngWord, Len(EngWord) - 1) & Left(EngWord, 1) & "ay"
If Left(EngWord, 1) = UCase(Left(EngWord, 1)) Then
strConvert = UCase(Left(strConvert, 1)) _
& LCase(Right(strConvert, Len(strConvert) - 1))
End If
EnglishToPig = strConvert
End Function
'---------------------------------------------------------'
Save words into an array:
For i = 1 To Len(LineOfText)
If Mid$(LineOfText, i, 1) <> " " Then
ReDim Preserve MyString(Words)
Do Until Mid$(LineOfText, i, 1) = " " _
Or Mid$(LineOfText, i, 1) = "," Or Mid$(LineOfText, i, 1) = "." _
Or Mid$(LineOfText, i, 1) = ":" Or Mid$(LineOfText, i, 1) = "-" _
Or i > Len(LineOfText)
MyString(Words) = MyString(Words) & Mid$(LineOfText, i, 1)
i = i + 1
Loop
Words = Words + 1
End If
Next i
'--------------------------------------------------------'
this is how i am trying to output it into another text field but it gives me an error.
'------------------------------------'
ReDim Preserve MyString(0 To Words)
Dim temp As String
For i = 0 To Words
temp = temp & EnglishToPig(MyString())
Next i
txtmain2.Text = temp
'------------------------------------'
PLEASE HELP!!!!!!!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|