CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2014
    Posts
    7

    to calculate vowels, consonants, and spaces in the text entered

    Hi everyone,
    need some help to create function to calculate vowels, consonants, and spaces in the text entered.
    have to use loops with Mid and Len
    any advice appreciated.
    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: to calculate vowels, consonants, and spaces in the text entered

    Write the steps down on a piece of paper, breaking down each process along the way. Test on paper, and when it works, start coding it!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: to calculate vowels, consonants, and spaces in the text entered

    Create a array of vowels

    If a loop count the number of spaces
    In another nested loop count the number of each of the entries in your array

    Check the length of the text then subtract the number of spaces and the number of vowels to get the number of consonants

    See .IndexOf method of the string class
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: to calculate vowels, consonants, and spaces in the text entered

    Mid and Len are still VB6 functions. I'd suggest having a look here at some of the String ( as Dm pointed out ) methods :

    http://www.codeguru.com/columns/vb/b...-in-vb.net.htm

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