USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  ASP - Active Server Page
Voltar
Autor Assunto:  Dúvida nas linhas...
Fernando
BRASÍLIA
DF - BRASIL
ENUNCIADA !
Postada em 31/03/2005 10:27 hs            
Olá pessoal estou iniciando em ASP sou estagiário e estou analisando um sistema em ASP, estou com dúvidas em relação a duas linhas de código, não consigo entender a função delas. Se algum de vocês puder me ajudar ficarei grato!
 
nu_fita = replace(trim(request("nu_fita")),"'", "")
dt_criacao = datepart("yyyy",vdt_criacao) & "/" & datepart("m",vdt_criacao) & "/" & datepart("d",vdt_criacao)
 
 
Fernando Cruz
   
vilmarbr
Pontos: 2843
SAO PAULO
SP - BRASIL
ENUNCIADA !
Postada em 31/03/2005 11:55 hs         
oi, leia a explicação das funções mencionadas abaixo(em inglês), caso não leia inglês, traduza em http://babelfish.altavista.com/
REPLACE
Microsoft® Visual Basic® Scripting Edition
Replace Function   Language Reference
Version 2
 
--------------------------------------------------------------------------------
Description
Returns a string in which a specified substring has been replaced with another substring a specified number of times.
Syntax
Replace(expression, find, replacewith[, start[, count[, compare]]])
The Replace function syntax has these parts:
Part Description
expression Required. String expression containing substring to replace. 
find Required. Substring being searched for.
replacewith Required. Replacement substring.
start Optional. Position within expression where substring search is to begin. If omitted, 1 is assumed. Must be used in conjunction with count.
count Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions. Must be used in conjunction with start.
compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. If omitted, the default value is 0, which means perform a binary comparison.
Settings
The compare argument can have the following values:
Constant Value Description
vbBinaryCompare 0 Perform a binary comparison.
vbTextCompare 1 Perform a textual comparison.

Return Values
Replace returns the following values:
If Replace returns
expression is zero-length Zero-length string ("").
expression is Null An error.
find is zero-length Copy of expression.
replacewith is zero-length Copy of expression with all occurences of find removed.
start > Len(expression) Zero-length string.
count is 0 Copy of expression.

Remarks
The return value of the Replace function is a string, with substitutions made, that begins at the position specified by start and and concludes at the end of the expression string. It is not a copy of the original string from start to finish.
The following example uses the Replace function to return a string:
Dim MyString
MyString = Replace("XXpXXPXXp", "p", "Y") ' A binary comparison starting at the beginning
       ' of the string. Returns "XXYXXPXXY".
MyString = Replace("XXpXXPXXp", "p", "Y", ' A textual comparison starting at position 3.
       ' Returns "YXXYXXY". 3, -1, 1)
 
DATEPART
Microsoft® Visual Basic® Scripting Edition
DatePart Function   Language Reference
Version 2
--------------------------------------------------------------------------------
Description
Returns the specified part of a given date.
Syntax
DatePart(interval, date[, Mindayofweek[, Minweekofyear]])
The DatePart function syntax has these parts:
Part Description
interval Required. String expression that is the interval of time you want to return. See Settings section for values.
date Required. Date expression you want to evaluate.
Mindayof week Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed. See Settings section for values.
Minweekofyear Optional. Constant that specifies the Min week of the year. If not specified, the Min week is assumed to be the week in which January 1 occurs. See Settings section for values.

Settings
The interval argument can have the following values:
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second

The Mindayofweek argument can have the following values:
Constant Value Description
vbUseSystem 0 Use National Language Support (NLS) API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday

The Minweekofyear argument can have the following values:
Constant Value Description
vbUseSystem 0 Use National Language Support (NLS) API setting.
vbMinJan1 1 Start with the week in which January 1 occurs (default).
vbMinFourDays 2 Start with the week that has at least four days in the new year.
vbMinFullWeek 3 Start with the Min full weekof the new year.
 
Remarks
You can use the DatePart function to evaluate a date and return a specific interval of time. For example, you might use DatePart to calculate the day of the week or the current hour.
The Mindayofweek argument affects calculations that use the "w" and "ww" interval symbols.
If date is a date literal, the specified year becomes a permanent part of that date. However, if date is enclosed in quotation marks (" "), and you omit the year, the current year is inserted in your code each time the date expression is evaluated. This makes it possible to write code that can be used in different years.
This example takes a date and, using the DatePart function, displays the quarter of the year in which it occurs.
Function GetQuarter(TheDate)
  GetQuarter = DatePart("q", TheDate)
End Function
 
TENTE PROCURAR NO SEU PC ESTE ARQUIVO DE HELP:
C:Program FilesMicrosoft Visual StudioCommonIDEIDE98MSE1033VBSCRIP5.CHM
ou em:
C:Arquivo de ProgramasMicrosoft Visual StudioCommonIDEIDE98MSE1033VBSCRIP5.CHM
 
Caso não apareça, instale o frontpage 2000 ou o visual studio 6 que estes arquivos de help aparecerão pra vc!
 
 

http://www.vilmarbro.com.br
   
Martini
Pontos: 2843 Pontos: 2843
PAROBÉ
RS - BRASIL
ENUNCIADA !
Postada em 31/03/2005 14:07 hs         
'retira o caracter ' do parâmetro
nu_fita = replace(trim(request("nu_fita")),"'", "")
 
'formata a data em aaaa/m/d
dt_criacao = datepart("yyyy",vdt_criacao) & "/" & datepart("m",vdt_criacao) & "/" & datepart("d",vdt_criacao)
 
   
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página