全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1870
推到 Plurk!
推到 Facebook!

怎样截取文本中指定位置的内容到数据库中?

尚未結案
xinxin
一般會員


發表:1
回覆:2
積分:0
註冊:2007-04-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-04-17 08:49:07 IP:202.118.xxx.xxx 訂閱
大家好,我是新手.很想知道怎样把文本中指定位置的内容截取到数据库中某个字段中?真心求助,谢谢!!!
h@visli
資深會員


發表:103
回覆:429
積分:431
註冊:2004-02-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-04-18 09:25:14 IP:219.133.xxx.xxx 訂閱
您說的“文本”是指哪裡?磁盤上的文本文件還是Memo或Edit中的內容?“指定位置”是如何指定的?

===================引 用 xinxin 文 章===================
大家好,我是新手.很想知道怎样把文本中指定位置的内容截取到数据库中某个字段中?真心求助,谢谢!!!
------
------------------------
博采眾家之長,奉獻綿薄之力
------------------------
xinxin
一般會員


發表:1
回覆:2
積分:0
註冊:2007-04-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-04-18 10:47:30 IP:202.118.xxx.xxx 訂閱
TI - [16S rDNA diversity analysis of 30 Streptomycetes isolates displaying
significant cytotoxic activity against B16 cell from near-shore sediments
of Hainan Island]
AU - Yan LP
FAU - Hong, Kui
AU - Hong K
JID - 21610860R
RN - 0 (Culture Media)
RN - 0 (DNA, Bacterial)
RN - 0 (DNA, Ribosomal)
RN - 0 (RNA, Ribosomal, 16S)
SB - IM
MH - Animals
MH - Cell Line, Tumor
MH - Culture Media
MH - DNA, Bacterial/genetics
MH - DNA, Ribosomal/genetics
MH - Melanoma, Experimental/*microbiology/pathology
MH - Mice
MH - Phenotype
MH - RNA, Ribosomal, 16S/genetics
MH - Seawater/*microbiology
MH - Streptomyces/*classification/genetics/isolation & purification/*physiology
EDAT- 2005/07/02 09:00
例如上面的文本文档,我想把所有MH后面的字符串整合到一起作为一个字符串存到数据库中的某个字段中
h@visli
資深會員


發表:103
回覆:429
積分:431
註冊:2004-02-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2007-04-18 15:18:57 IP:219.133.xxx.xxx 訂閱
var
F: TextFile;
Line, UnionStr: string;
begin
//關聯您的文本到變量F
AssignFile(F, 'C:\MyDoc.txt');
//打開文件,以供後面讀取
Reset(F);
//如果沒有到最後一行
while not Eof(F) do
begin
Readln(F, Line); //讀取一行內容到Line中
if Pos('MH ', Line) = 1 then //判斷該行是否是以"MH ”起始
UnionStr := UnionStr Copy(Line, 4, MaxInt);
end;
CloseFile(F);
//......
Table1.Fields[8].AsString := UnionStr; //寫入數據表字段中
//......
------
------------------------
博采眾家之長,奉獻綿薄之力
------------------------
xinxin
一般會員


發表:1
回覆:2
積分:0
註冊:2007-04-17

發送簡訊給我
#5 引用回覆 回覆 發表時間:2007-04-18 16:51:24 IP:202.118.xxx.xxx 訂閱
PMID- 15989257
IP - 2
DP - 2005 Apr
TI - [16S rDNA diversity analysis of 30 Streptomycetes isolates displaying
significant cytotoxic activity against B16 cell from near-shore sediments
of Hainan Island]
PG - 185-90
AD - State Key Laboratory of Tropical Crop Biotechnology, Institute of Tropical
Biosciences and Biotechnology, Chinese Academy for Tropical Agricuture
Sciences, Haikou 571101, China. lpyan@126.com
RN - 0 (DNA, Ribosomal)
RN - 0 (RNA, Ribosomal, 16S)
SB - IM
MH - Animals
MH - Cell Line, Tumor
MH - Culture Media
MH - DNA, Bacterial/genetics
MH - DNA, Ribosomal/genetics
MH - Melanoma, Experimental/*microbiology/pathology
MH - Mice
MH - Phenotype
MH - RNA, Ribosomal, 16S/genetics
MH - Seawater/*microbiology
MH - Streptomyces/*classification/genetics/isolation & purification/*physiology
EDAT- 2005/07/02 09:00

PMID- 12197410
DP - 2002 Jul
TI - [The role of infection and inflammation in the pathogenesis of
atherosclerosis]
PT - English Abstract
PT - Journal Article
PT - Review
TT - Uloha infekcie a zapalu v patogeneze aterosklerozy.
PL - Czech Republic
TA - Vnitr Lek
JT - Vnitrni lekarstvi
JID - 0413602
SB - IM
MH - Animals
MH - Arteriosclerosis/complications/pathology/*physiopathology
MH - Bacterial Infections/*complications
MH - Blood Vessels/pathology
MH - Humans
MH - Inflammation
RF - 60
非常感谢,还有一个问题,就是,如果是多篇文献存在一个文本文档中.我想把每篇文献中的MH提出来,分别存在同一个字段下的不同行(即每篇文献的MH是一个值),怎么做?


h@visli
資深會員


發表:103
回覆:429
積分:431
註冊:2004-02-13

發送簡訊給我
#6 引用回覆 回覆 發表時間:2007-04-18 18:50:20 IP:219.133.xxx.xxx 訂閱
這個其實很簡單,純屬應用技巧,你應該知道你每一篇文字的結構吧,比如什麼來標識文章開始或結束,例如以“PMID- ”來表示開始, 或以空行來區分兩篇文章,你只要分析這個標識就行了。
------
------------------------
博采眾家之長,奉獻綿薄之力
------------------------
系統時間:2024-05-08 10:49:19
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!