0

例如地址为:start http://127.0.0.1.co.th/af start

   I want to cut text from url when WhiteSpaces http://127.0.0.1.co.th/af
  <% str = "start http://127.0.0.1.co.th/af start"
   # cut start from url
  if instr(str,"http://")<> 0 then
  str = right(str,len(str) - instr(str,"http://") +1)
  end If
  if instr(str," ") <> 0 then
  str = left(str,instr(str," ") +3)
  end If
  %>
  <%=str%>
   I want to cut text from url when WhiteSpaces http://127.0.0.1.co.th/af start
   (cut start) How do it thk you
4

1 回答 1

0

Assuming you are attempting to cut out a URL from a string which may contain spaces, your code was pretty close. Looks like your second if statement was off a little bit to truncate the URL.

This should work:

<% 
str = "start http://127.0.0.1.co.th/af start"

if instr(str,"http://")<> 0 then
    str = right(str,len(str) - instr(str,"http://") +1)
end if
if instr(str," ") <> 0 then
    str = left(str,instr(str," "))
end if
%>

<%=str%>
于 2013-05-10T01:06:13.933 回答