function strLeft(str,num)
dim p_str,p_num
p_str = ""
p_num = 0
if trim(str) <> "" then
p_len = len(str)
for i = 1 to p_len
if asc(mid(str,i,1)) > 255 or asc(mid(str,i,1)) < 0 then
p_num = p_num + 2
else
p_num = p_num + 1
end if
if p_num > num then
p_str = Left(str,i-1)
exit for
else
p_str = str
end if
next
end if
strLeft=p_str
end functio