无标题文档
<%
Function StrLenB( strString )
dim intLoop,intReturn
if isNull(strString) then
StrLenB = 0
exit Function
end if
intReturn = len(strString)
for intLoop = 1 to len(strString)
if ( asc( mid( strString, intLoop, 1 ) ) < 0 ) then intReturn = intReturn + 1
next
StrLenB = intReturn
End Function
Function strLeftB( strString ,intLen)
dim intLenB,intLoop
if StrLenB(strString) < intLen then
strLeftB = strString
exit Function
end if
for intLoop = 1 to Len(strString)
if ( asc( mid( strString, intLoop, 1 ) ) < 0 ) then
intLenB = intLenB + 2
else
intLenB = intLenB + 1
end if
if intLenB > intLen then
intLoop = intLoop - 1
exit for
elseif intLenB = intLen then
exit for
end if
next
strLeftB = left(strString,intLoop)
End Function
Function IsLetter( chr )
dim blnReturn
blnReturn = false
if ( ( chr >= asc("a") and chr <= asc("z") ) or ( chr >= asc("A") and chr <= asc("Z") ) or ( chr >= asc("0") and chr <= asc("9") ) ) then
blnReturn = true
end if
IsLetter = blnReturn
End Function
Function AlignString( string, byVal size )
dim r,nLen,n,i,a,s_i
r = string
nLen = StrLenB( string )
' if string's width less then size ,return this string .
if ( nLen > size ) then
size = size - 2
n = 0
i = 1
' cut to index
do while ( i )
a = asc( mid( string, i, 1 ) )
if ( a < 0 ) then
if ( n + 1 = size ) then
i = i - 1
exit do
end if
n = n + 1
end if
n = n + 1
if ( n = size ) then exit do
i = i + 1
loop
'fxDebug( i )
s_i = i
a = asc( mid( string, i+1, 1 ) )
if ( IsLetter(a) ) then
do while ( 1 )
a = asc( mid( string, i, 1 ) )
if ( not IsLetter(a) ) then exit do
i = i -1
if ( i = 0 ) then
i = s_i
exit do
end if
loop
end if
r = mid( string, 1, i ) & "…"
end if
AlignString = r
End Function
%>