vault backup: 2025-05-20 11:14:59

This commit is contained in:
SeedList
2025-05-20 11:14:59 +08:00
parent 6e7d35ebc9
commit e1f761a779

View File

@ -463,4 +463,30 @@ begin
if A.itemindex <> -1 then
B.Text := A.Text;
end.
```
## 截取指定字符前的字符串
`cbxusr_pinpai` 未被勾选时,只保留 `fedtItemCode``-` 之前的部分
```Delphi
uses
MyClass, Variables, BaseUtil, CommonFunc, DataConst, CFFrm, CFSimplePropFrm,
Forms, StdCtrls, Variants, SysUtils, Classes, Controls, Dialogs,
CHostIntf, ProductClas, DocClas, LoginClas, VirtualTrees, CEntClas, PathClas;
var
DashPos: Integer; // 存储 "-" 的位置
begin
// 检查条件itemcode 包含 "-" 并且 cbxusr_pinpai 未勾选
if (Pos('-', fedtItemCode.Text) > 0) and (cbxusr_pinpai.Checked = false) then
begin
// 找到 "-" 的位置
DashPos := Pos('-', fedtItemCode.Text);
// 只保留 "-" 之前的部分
fedtItemCode.Text := Copy(fedtItemCode.Text, 1, DashPos - 1);
end;
if cbxusr_pinpai.checked = false then
fedtusr_gongyingshang.itemindex := -1;
end.
```