VBScript Multiple choices


Total available count: 25
Subject - Scripting Languages
Subsubject - VBScript

What is the use of the Asc() function in VBScript?


 

 

 

 



A


Solution:-

The Asc function
The Asc function converts the first character in a string to ANSI code and returns the result.

The Asc function Syntax is as below:

Asc(string)

string    -    A string expression. Cannot be an empty string! and it is Required. 

The Asc function Examples are as follows:

Example 1

<%

response.write(Asc("A") & "<br />")
response.write(Asc("a") & "<br />")
response.write(Asc("F") & "<br />")
response.write(Asc("f") & "<br />")
response.write(Asc("2") & "<br />")
response.write(Asc("#") & "<br />")

%>

The output of the above code will be as below:

65
97
70
102
50
35

Example-2

Asc returns the ANSI code of only the first character in a string:

<%

response.write(Asc("S") & "<br />")
response.write(Asc("SlightBook.com"))

%>

The output of the above code will be as below:

83
83

Example-3

How to return the ANSI code of all the characters in a string:

<%

txt="SlightBook.com"
for i=1 to len(txt)
  response.write(Asc(mid(txt,i,1)) & "<br />")
next

%>

The output of the above code will be as below:

83
108
105
103
104
116
32
66
111
111
107
46
99
111
109




Next 5 multiple choice(s)

1

What is the use of the Len() function in VBScript?

2

What is the use of Mid() function in VBScript?

3

What is the use of Spaces() function in VBScript?

4

What is the use of the Trim() function in VBScript?

5

Does Variant data type contain different kinds of information in VBScript?

Comments