0

can someplease please help me understand what the asc function and the mid function can do. does the asc function find the string and the mid function replace the string with a number. i have had a look in several books but none make sence
please

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by williamrojas78
0

Asc : This function convert first letter in the string to ANSI code.

Example:

Msgbox(Asc("A"))

Mid : Returns a Variant (String) containing a specified number of characters from a string.

Example

Dim a As String
a = Mid("Hello World", 2, 5)
Msgbox(a)
0

Have you looked in the help section of vb? All that information is there.

Asc Function

Returns anInteger representing thecharacter code corresponding to the first letter in a string.

Dim MyNumber
MyNumber = Asc("A")   ' Returns 65.
MyNumber = Asc("a")   ' Returns 97.
MyNumber = Asc("Apple")   ' Returns 65.

Mid Function

Returns a Variant (String) containing a specified number of characters from a string.

Dim MyString, FirstWord, LastWord, MidWords
MyString = "Mid Function Demo"   ' Create text string.
FirstWord = Mid(MyString, 1, 3)   ' Returns "Mid".
LastWord = Mid(MyString, 14, 4)   ' Returns "Demo".
MidWords = Mid(MyString, 5)   ' Returns "Function Demo".

Try the examples out and see what they do.

Hope it helps

regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.