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

Recommended Answers

All 2 Replies

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)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.