asp 函数
复制代码 代码如下:
function AnalyseKeyword(a_strSource)
dim m_strDest , m_intLoop
dim m_intBeginPos , m_intEndPos
dim m_strHead , m_strMiddle , m_strTail
m_strDest = a_strSource
'------------------------------处理空格------------------------------------------------------
'首先去掉头尾空格
m_strDest = ltrim(rtrim(m_strDest))
'将& , " and " 等替换成 +、 -、空格
m_strDest = replace(m_strDest , "&" , "+")
m_strDest = replace(m_strDest , " AND " , "+")
m_strDest = replace(m_strDest , " OR " , chr(32))
m_strDest = replace(m_strDest , " NOT " , "-")
'初始化变量,以使下面的循环进行
m_intBeginPos = 1
do while m_intBeginPos <> 0
m_intBeginPos = instr(m_strDest ,chr(32))
if m_intBeginPos <> 0 then '如果找到空格
m_strHead = rtrim(ltrim(left ( m_strDest , m_intBeginPos )))
call print("[AnalyseKeyword()]:处理空格m_strHead = " + m_strHead)
m_strTail = rtrim(ltrim(right (m_strDest , len(m_strDest) - m_intBeginPos)))
call print("[AnalyseKeyword()]:处理空格m_strTail = " + m_strTail)
内容版权声明:除非注明,否则皆为本站原创文章。