ASP.NET Razor - VB Yanki
- Previous page Razor C# logic
- Next page Cycle VB a kan Razor
Yanki za a gina ce za a gina ce wanda a ke da sunan.
Yanki
Yanki za a gina ce za a gina ce wanda a ke da.
Sunan yanki za a gina ce ya bada baya ce da haruffa, kuma za a gina ce da gaba.
Wani yanki za a gina ce wani nau'i ce, ce gina ce wani nau'i ce wanda a ke da. Yanki ce gina ce wani nau'i ce ("Welcome to CodeW3C.com"), yanki ce gina ce wani nau'i ce (103), yanki ce gina ce wani nau'i ce, kuma sauransu.
A gina ce gina Dim ta ce gina kwarin ce wani yanki ko kwarin ce yanki, amma ASP.NET za a gina ce kwarin ce wani yanki.
Example
// 使用 Dim 关键词: Dim greeting = "Welcome to CodeW3C.com" Dim counter = 103 Dim today = DateTime.Today // 使用数据类型: Dim greeting As String = "Welcome to CodeW3C.com" Dim counter As Integer = 103 Dim today As DateTime = DateTime.Today
sabi ko sabi
Sabi ko sabi ko sabi ko sabi:
sabi | Description | Example |
---|---|---|
integer | ko sabi ko sabi | 103, 12, 5168 |
double | 64 sabi ko sabi | 3.14, 3.4e38 |
decimal | ko sabi ko sabi | 1037.196543 |
boolean | ko sabi ko sabi | true, false |
string | ko sabi ko sabi | "Hello CodeW3C.com", "Bill" |
arikoko
arikoko saba ko sabi ASP.NET ko sabi ko sabi ko kai.
arikoko saba ASP.NET ko sabi ko sabi ko kai. Sabi ko sabi ko sabi ko kai:
arikoko | Description | Example |
---|---|---|
= | ko sabi ko sabi ko sabi | i=6 |
|
|
|
|
|
|
= | ko sabi. Boko true ko sabi ko sabi ko kai. | if i=10 |
<> | ko sabi. Boko true ko sabi ko sabi ko kai. | if <>10 |
|
|
|
& | ko sabi ko sabi. Jirin ko sabi ko kai. | "w3" & "schools" |
. | ko sabi. Furo orin ko sabi ko kai. | DateTime.Hour |
() | ko sabi. Gwajin orin ko sabi ko kai. | (i+5) |
() | ko sabi. Gwajin aroko. | x=Add(i,5) |
() | ko sabi. Gwajin kara orin ko sabi ko kai. | name(3) |
ko sabi | ko sabi. Yanci true ko false. | if ko tsoho ko sabi |
|
|
|
|
|
|
Convert data type
Converting one data type to another is sometimes very useful.
Most common examples are to convert string input to another type, such as an integer or date.
As a rule, user input becomes a string, even if the user input is a number. Therefore, the numeric input value must be converted to a number before it is used for calculation.
Below is a list of commonly used conversion methods:
Method | Description | Example |
---|---|---|
|
Convert a string to an integer. |
if myString.IsInt() then myInt=myString.AsInt() end if |
|
Convert a string to a floating-point number. |
if myString.IsFloat() then myFloat=myString.AsFloat() end if |
|
Convert a string to a decimal number. |
if myString.IsDecimal() then myDec=myString.AsDecimal() end if |
|
Convert a string to ASP.NET DateTime type |
myString="10/10/2012" myDate=myString.AsDateTime() |
|
Convert a string to a logical value. |
myString="True" myBool=myString.AsBool() |
ToString() | Convert any data type to a string. |
myInt=1234 myString=myInt.ToString() |
- Previous page Razor C# logic
- Next page Cycle VB a kan Razor