ผู้เขียน หัวข้อ: คำสั่งตัดคำ ใน pascal ครับ  (อ่าน 5126 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ gu_prajag

  • Sr. Member
  • ****
  • กระทู้: 253
  • Respect: +1
    • ดูรายละเอียด
คำสั่งตัดคำ ใน pascal ครับ
« เมื่อ: พฤษภาคม 22, 2015, 16:13:44 PM »
0
มีข้อความยาวๆ จะตัดให้เหลือตามต้องการครับ เช่น

 st1:=vartostr(getsqldata('select pdx from an_stat where an="'+fan+'"'));
 fcds['name6']:= st1;
 fcds['name7']:=vartostr(getsqldata('select name from icd101 where code="'+st1+'"'));

จะตัดชื่อการวินิจซึ่งยาวเกินไปให้เหลือสั้น เช่น
Foodborne Bacillus cereus intoxication -> เป็น Foodborne Bacillus.... มีจุดๆๆๆ ต่อท้าย
ศูนย์สารสนเทศ โรงพยาบาลมายอ/รพร.สายบุรี จ.ปัตตานี 
e-mail : my_kop@hotmail.com
SERVER :
CentOS+MariaDB

ออฟไลน์ chitvichai

  • Full Member
  • ***
  • กระทู้: 103
  • Respect: +5
    • ดูรายละเอียด
    • รพ.เมืองปาน
Re: คำสั่งตัดคำ ใน pascal ครับ
« ตอบกลับ #1 เมื่อ: พฤษภาคม 25, 2015, 10:34:24 AM »
0
มีข้อความยาวๆ จะตัดให้เหลือตามต้องการครับ เช่น

 st1:=vartostr(getsqldata('select pdx from an_stat where an="'+fan+'"'));
 fcds['name6']:= st1;
 fcds['name7']:=vartostr(getsqldata('select name from icd101 where code="'+st1+'"'));

จะตัดชื่อการวินิจซึ่งยาวเกินไปให้เหลือสั้น เช่น
Foodborne Bacillus cereus intoxication -> เป็น Foodborne Bacillus.... มีจุดๆๆๆ ต่อท้าย

ถ้าใช้ใน script delphi ของ HOSxP ก็ copy(fullstring,stringStart,lenString); จะได้
 
 st1:=vartostr(getsqldata('select pdx from an_stat where an="'+fan+'"'));
 fcds['name6']:= st1;
 st2:=vartostr(getsqldata('select name from icd101 where code="'+st1+'"'));
 fcds['name7']:=copy(st2,1,15)+"...";

แต่ใช้ sql query
เป็น substr(fullstring,stringStart,lenString) หรือ substring(fullstring,stringStart,lenString) จะได้
 st1:=vartostr(getsqldata('select pdx from an_stat where an="'+fan+'"'));
 fcds['name6']:= st1;
 st2:=vartostr(getsqldata('select concat(substr(name,1,15),"...") from icd101 where code="'+st1+'"'));
 fcds['name7']:=st2;



« แก้ไขครั้งสุดท้าย: พฤษภาคม 25, 2015, 10:50:43 AM โดย chitvichai »
โรงพยาบาลเมืองปาน (ขนาด 30 เตียง) จังหวัดลำปาง โทร 054-276345-6
Master Server : HP Proliant DL360G7 Ram DDR3 1333 ECC 2x2 GB  HDD 2x146 GB  CentOS 6.2 Linux MySQL 5.5.11
Slave Server I : Acer Altos G540 Ram DDR2 667 ECC 2x1 GB HDD 2x146 GB Redhat Ent 5.2 Linux Mysql 5.1.29
Slave Server II : คอมประกอบ Ram DDR2 667  2x2 GB HDD SATA 160 GB Endian Firewall Community release 2.4.1 Mysql 5.5.24
Client : Windows XP Sp2
ขึ้นระบบ 1 มิ.ย.50

ออฟไลน์ gu_prajag

  • Sr. Member
  • ****
  • กระทู้: 253
  • Respect: +1
    • ดูรายละเอียด
Re: คำสั่งตัดคำ ใน pascal ครับ
« ตอบกลับ #2 เมื่อ: พฤษภาคม 25, 2015, 11:00:38 AM »
0
ขอบคุณมากๆครับ chitvichai
ศูนย์สารสนเทศ โรงพยาบาลมายอ/รพร.สายบุรี จ.ปัตตานี 
e-mail : my_kop@hotmail.com
SERVER :
CentOS+MariaDB