CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Posts
    5

    Spliting sentances

    What I want to do is take a sentance- "Hello Bob" and split it letter-by-letter so
    word(1)=H
    word(2)=e
    word(3)=l
    word(4)=l
    word(5)=o
    word(6)=b (or blank for the space)
    word(7)=o
    word(8)=b

    Can Anyone Help?
    Thanks


  2. #2

    Re: Spliting sentances

    Create a string.
    Fill the string with Your text: "Hello Bob"
    Then use a do while loop to parse the string character by character setting your array equal each letter as it gets past. Look up the Left$ string function in your help and it should give you an idea of how things are done


  3. #3
    Guest

    Re: Spliting sentances

    Hi !

    Using the following code you can print a single letter from a word. To a new form add one command button and get it print to
    the form.

    Private Sub Command1_Click()

    Dim strInput As String
    Dim strWord(1 To 12) As String
    Dim intLen As Integer

    strInput = InputBox("Enter String")

    intLen = Len(strInput)
    For I = 1 To intLen Step 1
    strWord(I) = Mid(strInput, I, 1)
    'strInput = Mid(strInput, 1)
    Form1.Print "strWord(" & I & ")=" & strWord(I)
    Next I

    End Sub

    Satya N Chandu
    E Mail Address : [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured