Want to transfer the string A code using the
The word (TMP)//TMP: string='a'
When an error also, prompt incompatible type
But direct word (' a ')
no problemConsult everybody a great god what reason is this? Look at the online code with me the same but there is no problem?
CodePudding user response:
On word problems have been settled by https://blog.csdn.net/xufeichen/article/details/4480697, but if we aren'tCodePudding user response:
10.2 is ok, but cheap, there is a warning thatIf AnsiChar (' a ') in [' a ', 'b'] then...
It's good that
Or you can use the if CharInSet (' a '/' a ', 'b') then...
CodePudding user response:
But the there is a warningCodePudding user response:
Thanks to the upstairs to answer, can't, very embarrassed, is the version of the problem? I used to use 10.1 also is such, can only be used every time more than N and connectionCodePudding user response:
Never heard of CharInSet (' a ', [' a ', 'b']) no...CodePudding user response:
To try a KeyPress events:Procedure TFormMain. DBEditEh4KeyPress (Sender: TObject; Var Key: Char);
Var
I: Integer;
The begin
If DMADO. ADO exam. IsEmpty then
The Exit;
If (AnsiChar (Key) in [# 13, Char (VK_DOWN)]) and (ActiveControl is TDBEditEh) then
The begin
Key:=# 0;
CodePudding user response:
Little monkey is 10.3, don't know why I can't ~ ~ ~CodePudding user response:
This can alsoIf not (CharInSet (Key, [' 0 '... '9', '. ', '-', # 8])) then
Key:=# 0;
If (Key=') and (Pos ('. ', Edit4) text) & gt; 0) then
Key:=# 0;
CodePudding user response:
Is not scientific, D7 and D10 can test pass, the complete code is what?Var
TMP: string;
The begin
TMP:='a';
If TMP [1] in [' a ', 'b'] then
The begin
Showmessage (' matched ');
The end;
CodePudding user response:
CharInSet is high version of the Delphi advocate, in char constants have WideChar AnsiChar and ambiguityCodePudding user response:
CharInSet is also used in inside, just to avoid the direct use of character literals compiler warnings that appearCodePudding user response:
Are directly using pos function to determine whether a string in the string b, also is useless to the building Lord that kind of method