日期:2014-05-17  浏览次数:20877 次

取字段内容啊~
开新贴继续来看.

像A字段里有~

张三,李四,王五..等~且长度不定~既可能是汉字也有可能是E文数字之类~

但都有用   ,   来分割的~

呵呵~怎么取呢~40分啊


------解决方案--------------------
<%files_admin=rs( "A ") '字段A的内容赋值给files_admin
if files_admin <> empty then
ModeratedList= "姓名列表: "
filtrate=split(files_admin, "| ")
for i = 0 to ubound(filtrate)
ModeratedList= " "&ModeratedList& " "&filtrate(i)& "&nbsp; "
next
else
ModeratedList= " "
end if
Response.Write( " "&ModeratedList& " ")%>
就这样
------解决方案--------------------
for i=0 to ubound(split(rs( "A "), ", "))
response.write split(rs( "A "), ", ")(i)& " <br> "
next
------解决方案--------------------
/*************************************************
函数名:gotTopic
作 用:截字符串,汉字一个算两个字符,英文算一个字符
参 数:str ----原字符串
strlen ----截取长度
返回值:截取后的字符串
*************************************************/
function gotTopic($str,$strlen){
if($str== " "){
$gotTopic= " ";
exit;
}
$str=preg_replace(preg_replace(preg_replace(preg_replace($str, "&nbsp; ", " "), "&quot; ",chr(34)), "&gt; ", "> "), "&lt; ", " < ");
$l=strlen($str);
$t=0;
/*for($i=1; $i <=$l; $i++){
$c=abs(asc(substr($str,$i,1)));//acs()
if($c> 255){
$t=$t+2;
}else{
$t=$t+1;
}*/
if($l> =$strlen){
$gotTopic=substr($str,0,$i) . "… ";
exit;
}else{
$gotTopic=$str;
}
//}
return preg_replace(preg_replace(preg_replace(preg_replace(gotTopic, " ", "&nbsp; "),chr(34), "&quot; "), "> ", "&gt; "), " < ", "&lt; ");
}