Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to apply ASP.NET array

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to apply ASP.NET array". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Asp.net array (Array) can be regarded as a variable that stores multiple values of the same data type, representing multiple values differently by the same variable name and different index values. It is often used to store data of the same nature or type.

Declaration of the 1.ASP.NET array

The declaration of an array has the following two formats:

Dim array name (number of elements) [As data type]

Dim array name () [As data type] = {element value l, element value 2... }

Representation of 2.ASP.NET array elements

When an array is declared and assigned its elements, the array can be executed, where the elements of the array are represented as follows:

Array name (index value) = element value

Tip: the index value is calculated from O. The number of array elements can be declared up to 264-1 (that is, the Long type).

3.ASP.NET array example

Write an ASP program, use the array to make it into the web page

The ability to display the date of the day.

< html>

< hr>

< % Dim cw(7) cw(O)=¨星期日" . cw(1)=¨星期一" cw(2)="星期二" cw(3)=¨星期三" cw(4)=¨星期四¨ cw(5)=¨星期五" cw(6)=¨星期六¨ response.write(¨今天是¨&yea r(now())&"年") response.write(month(now()) & "月" &day(now()) & "日") response.write(cw(Wee kDay(now())一1)) %>

< hr>

< /html>

The procedure is described as follows

Lines 3-15: the body of the ASP program.

Line 4: declare an array of CW with seven elements.

Lines 5-11: define each element in the array. The data type is a string.

Lines 12-14: use the date-time function and array to output the date using the write method of the response object, where on line 14, the week value is obtained by substituting the WeekDay function. A, now () function, whose value range is 1-7, because the index value in the array is to be substituted, and the index value in the array is calculated from O, so subtract 1 in this output program and set the range of the week value at Olympus 6. To match the index values of the array to bring out the string that each index value represents.

This is the end of the content of "how to apply ASP.NET arrays". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report