vault backup: 2025-05-20 11:14:59
This commit is contained in:
@ -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.
|
||||
```
|
Reference in New Issue
Block a user