|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how can i detect multiplt VBNewLine's in a rowif i have a text area on a page that i want to validate, and i dont want
there to ever be 2 "enter"s in a row, how can i check for this? ive been playing with something like: If InStr(string, "vbnewline&vbnewline") <> 0 but i cant get that to work no matter what i do with the quotes etc. but thats the general idea of what i want to do. any ideas? SLH wrote:
> if i have a text area on a page that i want to validate, and i dont vbCrLf & vbCrLf> want there to ever be 2 "enter"s in a row, how can i check for this? > ive been playing with something like: > > If InStr(string, "vbnewline&vbnewline") <> 0 > > but i cant get that to work no matter what i do with the quotes etc. > but thats the general idea of what i want to do. > any ideas? -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup. thank you ill try that now. question, what is the actual difference between
vbNewLine and vbCrLf? i ask because i do some other things on various pages using vbNewLine and im wondering if there is good reason to change it to vbCrLf thanks Show quoteHide quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:OpvDwsH6GHA.4644@TK2MSFTNGP04.phx.gbl... > SLH wrote: >> if i have a text area on a page that i want to validate, and i dont >> want there to ever be 2 "enter"s in a row, how can i check for this? >> ive been playing with something like: >> >> If InStr(string, "vbnewline&vbnewline") <> 0 >> >> but i cant get that to work no matter what i do with the quotes etc. >> but thats the general idea of what i want to do. >> any ideas? > > vbCrLf & vbCrLf > -- > Microsoft MVP -- ASP/ASP.NET > Please reply to the newsgroup. The email account listed in my From > header is my spam trap, so I don't check it very often. You will get a > quicker response by posting to the newsgroup. > > They are platform/situation-dependent:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp I posted that suggestion without testing, assuming it would be the answer. It turns out I was wrong. According to this test: <% dim s, i, ar ar=array(vbNewLine, vbCrLf) for each s in ar Response.Write "Next constant:<BR>" for i = 1 to len(s) Response.Write Asc(mid(s,i,1)) & "<BR>" next next %> The two constants would seem to be equivalent in this situation. So, I would suggest looping through your string (similar to the above) and discover what actually is being passed in the form submission for line break characters. In fact, based on this test: <% if Request.Form.Count>0 then dim s, i s=Request.Form("txt") for i = 1 to len(s) Response.Write Asc(mid(s,i,1)) & "<BR>" next Response.Write "Instr(s,vbCrLf & vbCrLf): " & Instr(s,vbCrLf & vbCrLf) & "<BR>" Response.Write "Instr(s,vbNewLine & vbNewLine): " & Instr(s,vbNewLine & vbNewLine) & "<BR>" end if %> <HTML> <BODY> <FORM action="" method=POST id=form1 name=form1> <textarea name=txt></textarea> <INPUT type="submit" value="Submit" id=submit1 name=submit1> </FORM> </BODY> </HTML> Both constants seem to work when I enter a<enter><enter>a in the text area and submit it. SLH wrote: Show quoteHide quote > thank you ill try that now. question, what is the actual difference > between vbNewLine and vbCrLf? > i ask because i do some other things on various pages using vbNewLine > and im wondering if there is good reason to change it to vbCrLf > > thanks > > > > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message > news:OpvDwsH6GHA.4644@TK2MSFTNGP04.phx.gbl... >> SLH wrote: >>> if i have a text area on a page that i want to validate, and i dont >>> want there to ever be 2 "enter"s in a row, how can i check for this? >>> ive been playing with something like: >>> >>> If InStr(string, "vbnewline&vbnewline") <> 0 >>> >>> but i cant get that to work no matter what i do with the quotes etc. >>> but thats the general idea of what i want to do. >>> any ideas? >> >> vbCrLf & vbCrLf >> -- >> Microsoft MVP -- ASP/ASP.NET >> Please reply to the newsgroup. The email account listed in my From >> header is my spam trap, so I don't check it very often. You will get >> a quicker response by posting to the newsgroup. -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Show quote
Hide quote
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message right now im looking for vbCrLf & vbCrLf (2 or more in a row) and replacing news:uVaT$KI6GHA.1688@TK2MSFTNGP06.phx.gbl... > They are platform/situation-dependent: > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp > > I posted that suggestion without testing, assuming it would be the > answer. It turns out I was wrong. According to this test: > <% > dim s, i, ar > ar=array(vbNewLine, vbCrLf) > for each s in ar > Response.Write "Next constant:<BR>" > for i = 1 to len(s) > Response.Write Asc(mid(s,i,1)) & "<BR>" > next > next > %> > > The two constants would seem to be equivalent in this situation. So, I > would suggest looping through your string (similar to the above) and > discover what actually is being passed in the form submission for line > break characters. > > In fact, based on this test: > <% > if Request.Form.Count>0 then > dim s, i > s=Request.Form("txt") > for i = 1 to len(s) > Response.Write Asc(mid(s,i,1)) & "<BR>" > next > Response.Write "Instr(s,vbCrLf & vbCrLf): " & Instr(s,vbCrLf & vbCrLf) > & "<BR>" > Response.Write "Instr(s,vbNewLine & vbNewLine): " & Instr(s,vbNewLine & > vbNewLine) & "<BR>" > end if > %> > <HTML> > <BODY> > <FORM action="" method=POST id=form1 name=form1> > <textarea name=txt></textarea> > <INPUT type="submit" value="Submit" id=submit1 name=submit1> > </FORM> > </BODY> > </HTML> > > Both constants seem to work when I enter a<enter><enter>a in the text > area and submit it. > > > > SLH wrote: >> thank you ill try that now. question, what is the actual difference >> between vbNewLine and vbCrLf? >> i ask because i do some other things on various pages using vbNewLine >> and im wondering if there is good reason to change it to vbCrLf >> >> thanks >> >> >> >> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message >> news:OpvDwsH6GHA.4644@TK2MSFTNGP04.phx.gbl... >>> SLH wrote: >>>> if i have a text area on a page that i want to validate, and i dont >>>> want there to ever be 2 "enter"s in a row, how can i check for this? >>>> ive been playing with something like: >>>> >>>> If InStr(string, "vbnewline&vbnewline") <> 0 >>>> >>>> but i cant get that to work no matter what i do with the quotes etc. >>>> but thats the general idea of what i want to do. >>>> any ideas? >>> >>> vbCrLf & vbCrLf >>> -- >>> Microsoft MVP -- ASP/ASP.NET >>> Please reply to the newsgroup. The email account listed in my From >>> header is my spam trap, so I don't check it very often. You will get >>> a quicker response by posting to the newsgroup. > > -- > Microsoft MVP -- ASP/ASP.NET > Please reply to the newsgroup. The email account listed in my From > header is my spam trap, so I don't check it very often. You will get a > quicker response by posting to the newsgroup. > > with a single vbCrLf. i keep looping until theyve all been replaced. this seems to work.... SLH wrote:
> right now im looking for vbCrLf & vbCrLf (2 or more in a row) and Something like this?> replacing with a single vbCrLf. > i keep looping until theyve all been replaced. this seems to work.... Do Until Instr(string, vbCrLf & vbCrLf)=0 string = Replace(string,vbCrLf & vbCrLf,vbCrLf) Loop (yeah, I know there's a great regex solution for this, but I'm leaving that as an exercise ... ) -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup. SLH wrote:
> if i have a text area on a page that i want to validate, and i dont Oh jeez, I just noticed. it should be:> want there to ever be 2 "enter"s in a row, how can i check for this? > ive been playing with something like: > > If InStr(string, "vbnewline&vbnewline") <> 0 > If InStr(string, vbnewline & vbnewline) > 0 then -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Problem with asp page returning a jpg image...
Export data to Excel How do I make sure that a asp page expires immediately and is not stored in the history ??? How to collect uncertain number of people information in a form How expensive is object instantication? 3-factor login system Restrict access by ip Split, convert date question ?? Random GUID type number or RegExp Jet Database Error |
|||||||||||||||||||||||