cStr1 = "把一串截为3段,如果含有不定长双字节字符就不能随便截断, 既然用到备注字段,为何还要截断来保存?" + ;
"先把文本导入到备注字段,在按长度分别导出这三个字段内容,能行不?" + ;
"人发可个方和方经品他三方登1山泛水多福多寿辅导费对方01234567890" + ;
"不明白楼主说的文本内容超长是什么意思,vfp字符型字段最多导入254个字符,共有294个字符"
?LEN(cStr1)
DIMENSION MyAry[4]
=CutStr(cStr1,@MyAry,4,99)
?MyAry[1]
?MyAry[2]
?MyAry[3]
?MyAry[4]
FUNCTION CutStr(cStr,aMyAry,nAry,nMaxLen)
LOCAL cStr1,nLen,nLen1,nStart,i
nLen = LEN(cStr)
IF nMaxLen * nAry < nLen &&不够长度
RETURN .f.
ELSE
nStart = 1
FOR i=1 TO nAry
cStr1 = SUBSTRC(SUBSTR(cStr,nStart,nMaxLen),1,nMaxLen) &&这句是最主要的.
nLen1 = LEN(cStr1)
nStart = nStart + nLen1
aMyAry[i] = cStr1
nLen = nLen - nLen1
ENDFOR
RETURN Iif(nLen = 0,.t.,.f.) && 正常情况,最后 nLen=0
ENDIF
ENDFUNC
"先把文本导入到备注字段,在按长度分别导出这三个字段内容,能行不?" + ;
"人发可个方和方经品他三方登1山泛水多福多寿辅导费对方01234567890" + ;
"不明白楼主说的文本内容超长是什么意思,vfp字符型字段最多导入254个字符,共有294个字符"
?LEN(cStr1)
DIMENSION MyAry[4]
=CutStr(cStr1,@MyAry,4,99)
?MyAry[1]
?MyAry[2]
?MyAry[3]
?MyAry[4]
FUNCTION CutStr(cStr,aMyAry,nAry,nMaxLen)
LOCAL cStr1,nLen,nLen1,nStart,i
nLen = LEN(cStr)
IF nMaxLen * nAry < nLen &&不够长度
RETURN .f.
ELSE
nStart = 1
FOR i=1 TO nAry
cStr1 = SUBSTRC(SUBSTR(cStr,nStart,nMaxLen),1,nMaxLen) &&这句是最主要的.
nLen1 = LEN(cStr1)
nStart = nStart + nLen1
aMyAry[i] = cStr1
nLen = nLen - nLen1
ENDFOR
RETURN Iif(nLen = 0,.t.,.f.) && 正常情况,最后 nLen=0
ENDIF
ENDFUNC
[此贴子已经被作者于2018-4-11 21:08编辑过]