Can you send me a code to my program..
this is my problem:
"enter a sentence and determine the number of words present in a particular sentence."
thank you..i hope you can send me the code i need,
thank you...god bless,,,,,,,,
Below is the code....you can skip the isWord check if you want to count numbers as well. Hope this helps...
Function countWords(str As String) As Long Dim words() As String, i As Long, numWords As Long words = Split(str, " ") For i = LBound(words) To UBound(words) If isWord(words(i)) Then numWords = numWords + 1 End If Next countWords = numWords End Function
Function isWord(str As String) As Boolean Dim ret As Boolean If str = Null Then ret = False ElseIf Len(str) = 0 Then ret = False ElseIf Mid(str, 1, 1) >= "A" And Mid(str, 1, 1) <= "Z" Then ret = True ElseIf Mid(str, 1, 1) >= "a" And Mid(str, 1, 1) <= "z" Then ret = True Else ret = False End If isWord = ret End Function
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need. goodluck!
- If you need clarification, ask it in the comment box above.
- Better answers use proper spelling and grammar.
- Provide details, support with references or personal experience.
Tell us some more! Your answer needs to include more details to help people.You can't post answers that contain an email address.Please enter a valid email address.The email address entered is already associated to an account.Login to postPlease use English characters only.
Tip: The max point reward for answering a question is 15.
I am sorry but due to your EULA we cannot provide you with a key
for this software. You must contact the publisher for a legally obtained
key. FixYa TOS does not allow for us to assist with copies of keys,
codes, ids, or software as it is against the law.
type of piracy is the illegal duplication and sale of copyrighted material with
the intent to directly imitate the copyrighted product. In the case of packaged
software, counterfeit versions often include copies of CDs or diskettes
containing the software programs, as well as related packaging, manuals,
license agreements, labels, registration cards, and security features.
Piracy is stealing. If you or your company were caught pirating software, you
could be held liable under both civil and criminal law. If a copyright owner
brings a civil action against you, the penalties in the U.S. may be up to
$150,000 for each program copied. The U.S. government can also criminally
prosecute you. If you are convicted, you can be fined up to $250,000, sentenced
to jail for up to five years, or both.
If this occurs in specific link, the problem must be parametric. Or if it appears in all the link, you should reinstall the word document again and if the problem does not resolve, remove Microsoft Visual Basic Enterprise completely and then check. If it is opening correctly, then reinstall Microsoft Visual Basic Enterprise. If problem appreas again, there must be something fishy in your Visual Basic disk.
Sub aa() ' ' aa Macro ' ' Dim a As String a = "how are you this is dharani" Dim leng, cnt As Integer
leng = 1 cnt = 0
While leng <= Len(RTrim(a)) If Mid(a, leng, 1) = " " Then cnt = cnt + 1 End If leng = leng + 1 Wend If Len(RTrim(a)) > 0 Then cnt = cnt + 1 End If MsgBox Str(cnt) + " Words" End Sub
I wrote this as a vbscript. It's Visual Basic code in windows script.
If you have XP, just copy the text into notepad and save it as
"vowel.vbs". Now double click the newly created script file.
' vowel.vbs ' ' This VBScript is used to count the vowels and consonants in a string. ' Designed and Tested on Windows XP Pro SP2 ' ' Version 1.0.0 - 02.20.2008 ' ' This code may be freely distributed or modified. ' -----------------------------------------------------------------'
Option Explicit Dim str Dim vowels Dim consonants Dim i
vowels = 0 consonants = 0 str = "hello"
for i = 1 to len(str) select case mid(str,i,1) case "a" vowels = vowels + 1 case "e" vowels = vowels + 1 case "i" vowels = vowels + 1 case "o" vowels = vowels + 1 case "u" vowels = vowels + 1 case else consonants = consonants + 1 end select next
Sub CountCharacters(Text As String) Dim iVowel As Integer Dim iCons As Integer Dim iNum As Integer Dim iSpace As Integer Dim iOther As Integer
Dim cnt As Integer Dim sChar As String
For cnt = 1 To Len(Text) sChar = LCase(Mid(Text, cnt, 1))
Select Case sChar Case "a", "e", "i", "o", "u" ' And sometimes "y"? ' Vowel iVowel = iVowel + 1 Case "a" To "z" ' Includes the first case, but VB matches the first case and stops iCons = iCons + 1 Case "0" To "9" ' Numbers iNum = iNum + 1 Case " ", vbTab, vbLf ' Space characters ' Not including vbCr as this will likely be dealing with Windows text ' and I only want to match one character for a newline iSpace = iSpace + 1 Case Else If sChar <> vbCr Then iOther = iOther + 1 End Select Next cnt
Private Sub Command1_Click()
Dim a Dim vow, con As Integer vow = 0 con = 0 For i = 1 To Len(Text1) a = Mid(Text1, i, 1) If (a = "a" Or a = "e" Or a = "i" Or a = "o" Or a = "u") Then vow = vow + 1 Else con = con + 1 End If Next
MsgBox "Vowels: " & vow & vbNewLine & "Consonants : " & con