delphi中stringgrid中的cell里的format计算问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 09:21:15
在单元格里的字符串有%,如何在调用这个单元格的数字的时候,去点%参加计算。否则总是出现错误提示。谢谢

首先uses StrUtils;
假设字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’i is th’
RightStr(Dstr, 6) := ’e BEST’

假设你的单元格的一个字符串赋值给s,那么可以这么取出来:
L:=length(s);
Fl:=strtofloat(leftstr(s,L-1));