Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Today, –Some Date functions/formats –Number Formats –Some String functions –String/Integer Conversions –Control Statements If then...Elseif then...else.

Similar presentations


Presentation on theme: "1 Today, –Some Date functions/formats –Number Formats –Some String functions –String/Integer Conversions –Control Statements If then...Elseif then...else."— Presentation transcript:

1 1 Today, –Some Date functions/formats –Number Formats –Some String functions –String/Integer Conversions –Control Statements If then...Elseif then...else Select case –Loop Statements Do...while While... Wend For each.. in.. Next –How to get server variables

2 2 Date() Today is, the month is ; the date is - - Today is Thursday, the month is February; the date is 22-2-2005

3 3 Date Formats <% var1 = now() response.write var1 %> format 0 = format 1 = format 3 = format 4 = 2/17/2005 12:10:37 AM format 0 =2/17/2005 12:10:37 AM format 1 =Thursday, February 17, 2005 format 2 =2/17/2005 format 3 =12:10:37 AM format 4 =00:10

4 4 Number Formats FormatNumber(NumToBeFormatted, NumOfDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers) In last 2 parameters; -1 for true, 0 for false, or -2 to use regional settings <% var1 = 55556.4333 var2 = -544545.823%>  var1 = 55,556.43 var2 =  var2 = (544,545.8) var1 =  var1 = $55,556.43 var2 =  var2 = ($544,545.8) var1 =  var1 = 5,555,643.33% var2 =  var2 = (54,454,582.3%)

5 5 Strings LEN # of char. of a string  12 INSTR (index, long_string, string) 0 for binary, 1 for text compare! “%> " 'writes 22%> <% mystr2 = "abcdefgh" response.write Instr(mystr2, "de") &" "  4 response.write len(mystr2)&" “  8 LCASE - UCASE response.write LCase(mystr2)&" “  abcdefgh response.write UCase(mystr2) &" “ %>  ABCDEFGH

6 6 Strings LEFT, RIGHT, MID <% mystr3 = "THE LORD OF THE RINGS" response.write LEFT(mystr3,3) &" “  THE response.write RIGHT(mystr3,5)&" “  RINGS response.write MID(mystr3,5,4)&" “ %>  LORD REVERSE STRING <% mystr4 = "kitap" response.write strReverse(mystr4)&" “ %>

7 7 Convert To Strings/Integers <% myint = 41 mystr = CStr(myint) & " " & "times Masallah!" response.write mystr %> <% mystr = "12" myint = CInt(mystr)/3 'myint will be 4 response.write myint %>

8 8 Select...Case Statements These are useful when you want to test one condition and do multiple actions based upon it. <% select case a case 1 ‘do this... case 2 ‘do this... case 3 ‘do this... case else ‘do this... end select %> <% if a = “1” then ‘do this Elseif a = “2” then ‘do this Elseif a = “3” then ‘do this Elseif a= “4” then ‘do this End if %> More then a few results

9 9 Do...Loop Statements Do Loop continues to do a specific action until the supplied statement is found to be true... <% Do { While Condition | Until Condition } ‘do this loop %> - Or - <% Do ‘do this Loop { While Condition | Until Condition } %>

10 10 Do...Loop Statements Do Loop continues to do a specific action until the supplied statement is found to be true... <% i= 0 Do While i < 5 Response.write(“i=“ & i &” ”) i = i +1 loop %>

11 11 While...WEnd Statements This loop performs the requested action until a condition is met <% While {Condition} ‘perform this WEnd %>

12 12 While...WEnd Statements It is commonly used to loop through a recordset that has been returned from a database. <% While NOT RS.EOF response.write(“Name= “ &RS(“Fname”) & “ ”) RS.MoveNext WEnd %>

13 13 For each...Next Statements It is used to loop through collections like recordsets, form collections, or arrays. <% gunler = Array(“Pazartesi”, “Sali”, “Çarşamba”, Perşembe,”Cuma”, “Cumartesi”, “Pazar”) For Each gun in gunler response.write gun response.write “ ” Next %>

14 14 For each...Next Statements It is used to loop through collections like recordsets, form collections, or arrays. <% For Each x in Request.ServerVariables response.write (x &“ = “ & Request.ServerVariables(x) & “ ”) Next %>

15 15 How to Get Server Variables Server variables are environment variables that tell you about the environment that your application is running in. <% response.write (Request.ServerVariables(“server_variable_name”)) %> Exp: <% response.write (Request.ServerVariables(“REMOTE_ADDR”)) response.write (Request.ServerVariables(“HTTP_USER_AGENT”)) %>


Download ppt "1 Today, –Some Date functions/formats –Number Formats –Some String functions –String/Integer Conversions –Control Statements If then...Elseif then...else."

Similar presentations


Ads by Google