Question about Microsoft Visual Basic 6.0 for PC

1 Answer

With spaces and exclude spaces

Accept for a string as input.display the total number of character..

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Vice President:

    An expert whose answer got voted for 100 times.

  • Expert
  • 285 Answers

Use the Len function
number_or_characters = Len(your_input_string)

Taking input from a TextBox is easy:
number_or_characters = Len(txtInput.Text)

Posted on Apr 23, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Divide the word Dangerous into syllabes


(sounds like a school assignment to me) ;-)

-count (& save) the 3 characters (1st syllable).
-start at position 4 (3+1 chars) in the string.
-count (& save) the 3 characters (2nd syllable).
-start at position 7 (6+1 chars) in the string.
-count (& save) the 3 characters (3rd syllable).

Logic:

-Initialize syllable-counter (x) to 1, position-counter to 1 (z).
-Initialize syl(x) strings to Null, where x = 1 to 3.
-Assign "dangerous" to string variable.

z = 1
y = 1
x = 1
string = "DANGEROUS"

For x = 1 to 3 DO
*Comment. read 3 chars (in a loop), add them to Syl (x).
For y = 1 to 3 DO
read a char(y) from the string at position-counter(z)
syl(x) = syl(x) + char(y)
z = z + 1
END DO
END DO


NOTE: not 100%, but close.

May 13, 2014 | Compilers & Programming Tools

2 Answers

What is strings in java?


Handling character strings in Java is supported through two final
classes: Java String and StringBuffer. The String class implements immutable character strings, which are read-only once the string has been created and initialized, whereas the StringBuffer class implements dynamic character strings. All string literals in Java programs, are implemented as instances of String class. Strings in Java are 16-bit Unicode.

Nov 21, 2012 | Sun Java Programming Language (cdj-275)

1 Answer

Write a program that accept a number and output its equivalent in word


Use the value that will be printed by the keyboar.
After you enter the value.
You have to cast the type you have used as integer or float into string or character type.
So here the type casting of the datatype will be used.

Oct 10, 2011 | Borland Turbo C++ 4.5 Full Version for PC

3 Answers

A java code for anagram


import java.io.IOException;

public class AnagramApp {
static int size;

static int count;

static char[] charArray;

public static void main(String[] args) throws IOException {
String input = "Java Source and Support";
size = input.length();
count = 0;
charArray = new char[size];
for (int j = 0; j < size; j++)
charArray[j] = input.charAt(j);
doAnagram(size);
}

public static void doAnagram(int newSize) {
int limit;
if (newSize == 1) // if too small, return;
return;
// for each position,
for (int i = 0; i < newSize; i++) {
doAnagram(newSize - 1); // anagram remaining
if (newSize == 2) // if innermost,
display();
rotate(newSize); // rotate word
}
}

// rotate left all chars from position to end
public static void rotate(int newSize) {
int i;
int position = size - newSize;
// save first letter
char temp = charArray[position];
//shift others left
for (i = position + 1; i < size; i++)
charArray[i - 1] = charArray[i];
//put first on right
charArray[i - 1] = temp;
}

public static void display() {
System.out.print(++count + " ");
for (int i = 0; i < size; i++)
System.out.print(charArray[i]);
System.out.println();
}
}

Nov 22, 2010 | Compilers & Programming Tools

1 Answer

I want to have the source codes for printing diamond shape asterisk in visual basic


I am pretty sure I got this as a homework assignment in programming class. If I had someone give it to me then I wouldn't be even the limited programmer I am now. That said, I will help, but I will not give you the full out answer.

  1. The number of stars and characters per line are an odd number to make the ASCii look like a diamond. For my example, the maximum number of characters per line is five.
  2. Create a variable called dia_star that will hold the spaces and stars. To figure out the number of spaces that should be put into each star line, use this formula:
number of spaces per star = ( max number of characters per line - number of stars) / 2
dia star = number of lines before star and "*"
print dia star

  1. --*--
  2. -***-
  3. *****
Good Luck,

NOLA Tech

Jan 30, 2010 | Microsoft Visual Basic Enterprise Edition...

1 Answer

Please Solve this C++ Program


Write a program to prompt the user to input several lines of input. A line of inputs is terminated by '*'. For each readline of input the program should output:(use pointer notation for the array) . The total # of words . The lenght of the longest word in the line At the end the program should output: . The total number of words read in all lines of input . The lenght of the longest word read in all lines of input

Jan 19, 2009 | Compilers & Programming Tools

1 Answer

I'm a Fresher in ASP.NET 2.0, Please help me


You need to change the column type from BoundField to TemplateField and call the substring method like this

<asp:TemplateField>
<HeaderTemplate>
Comments
</HeaderTemplate>
<ItemTemplate>
<%#Eval("Comments").ToString().Substring(0, 25)%>
</ItemTemplate>
</asp:TemplateField>
In this snippet, I am displaying only the first 25 characters of the Comments field.Only problem with this approach is that if even one of the rows contains a comments field with less than 25 characters, this might trigger an error.The fool proof way then is to write a small function in codebehind which will check the length of the field, chop off any extra characters and in case of shorter strings,

( THANKING " Balgates " For this HELP )

Apr 21, 2008 | Compilers & Programming Tools

2 Answers

Help me


this the code for your problem. by the way this for vb6.0

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

Debug.Print "Text: " & Text
Debug.Print "Vowels: " & CStr(iVowel)
Debug.Print "Consonants: " & CStr(iCons)
Debug.Print "Numbers: " & CStr(iNum)
Debug.Print "Space characters: " & CStr(iSpace)
Debug.Print "Other: " & CStr(iOther)
End Sub

Feb 21, 2008 | Compilers & Programming Tools

1 Answer

Help me


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

Debug.Print "Text: " & Text
Debug.Print "Vowels: " & CStr(iVowel)
Debug.Print "Consonants: " & CStr(iCons)
Debug.Print "Numbers: " & CStr(iNum)
Debug.Print "Space characters: " & CStr(iSpace)
Debug.Print "Other: " & CStr(iOther)
End Sub

Feb 21, 2008 | Compilers & Programming Tools

Not finding what you are looking for?
Microsoft Visual Basic 6.0 for PC Logo

Related Topics:

63 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Alex Krenvalk

Level 2 Expert

401 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Are you a Microsoft Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...