Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
You can count the number of spaces in the words fr...
Author:
Alok Rai
E-mail:
Click to e-mail author
Submitted:
5/24/2001
Version:
VB6
Compatibility:
VB6
Category:
String Manipulation
Views:
12660
You can count the number of spaces in the words from any corner of the word and also u can see the word with out space.
Declarations:
'none
Code:
' first of all create three text boxes labelled "Enter the any words with the spaces ","Total no of spaces in the entered words" and "words without space" Public Function calculatespace(str As String, counter As Integer) For I = 1 To Len(str) A = Mid(str, I, 1) If A = " " Then counter = counter + 1 End If Next I calculatespace = counter End Function Private Sub Text1_Change() Text2.Text = calculatespace(Text1.Text, 0) Text3.Text = Stringwithoutspace(Text1.Text, "") End Sub Public Function Stringwithoutspace(str1 As String, str2 As String) str2 = "" For I = 1 To Len(str1) A = Mid(str1, I, 1) If Not (A = " ") Then str2 = str2 & A End If Next I Stringwithoutspace = str2 End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement