Home > Back-end >  Delphi full word matching function implementation
Delphi full word matching function implementation

Time:10-19

To achieve full word matching function of Delphi,
Such as: select var_d var_dd, var_d_his from table, will get results var_d replaced with ss,
Select ss, var_dd var_d_his from table,
The existing StringReplace function, will become like this, the replaced
Select ss, SSD, ss_his from table,
Did anyone give a method, or stick the code,,,, Delphi,


Post for the first time, but will stick, stick, a satisfactory answer immediately, the, thanks.

CodePudding user response:

StringReplace (' select var_d var_dd, var_d_his from table ', 'var_d', 'ss' [rfIgnoreCase]);

So you only replace the first matching words

CodePudding user response:

refer to the original poster dark0oo5 response:
to achieve full word matching function of Delphi,
Such as: select var_d var_dd, var_d_his from table, will get results var_d replaced with ss,
Select ss, var_dd var_d_his from table,
The existing StringReplace function, will become like this, the replaced
Select ss, SSD, ss_his from the table...


The key is I may have more than one var_d inside,

CodePudding user response:

With this:
To achieve full word matching function of Delphi,
Such as: the select var_d, var_dd var_d_his, var_d from table, will get results var_d replaced with ss,
Select the ss, var_dd var_d_his, ss from table,
The existing StringReplace function, will become like this, the replaced
Select the ss, SSD, ss_his, ss from the table,

CodePudding user response:

reference dark0oo5 reply: 3/f
with this:
To achieve full word matching function of Delphi,
Such as: the select var_d, var_dd var_d_his, var_d from table, will get results var_d replaced with ss,
Select the ss, var_dd var_d_his, ss from table,
The existing StringReplace function, will become like this, the replaced
Select ss, SSD,...


reference 1st floor kiboisme response:
StringReplace (' select var_d, var_dd, var_d_his from table ', 'var_d', 'ss' [rfIgnoreCase]);

Thus replacing the first matching character only the


1st floor of the method is right, or StringReplace (' select var_d, var_dd, var_d_his from table ', 'var_d', 'ss', []);

StringReplace last parameter will only replace the first without rfReplaceAll var_d

CodePudding user response:

reference 4 floor feiba7288 response:
reference dark0oo5 reply: 3/f for this:
To achieve full word matching function of Delphi,
Such as: the select var_d, var_dd var_d_his, var_d from table, will get results var_d replaced with ss,
Select the ss, var_dd var_d_his, ss from table,
Existing StringReplace function, the meeting after replacement into...



Not only a var_d,,, not yet understand,

CodePudding user response:

reference 5 floor dark0oo5 reply:
reference 4 floor feiba7288 response: reference dark0oo5 reply: 3/f for this:
To achieve full word matching function of Delphi,
Such as: the select var_d, var_dd var_d_his, var_d from table, will get results var_d replaced with ss,
Select the ss, var_dd var_d_his, ss from table,
The existing S...



StringReplace (' select var_d var_dd, var_d_his from table ', 'var_d,', 'ss', ', [rfReplaceAll rfIgnoreCase]);

Add a comma replacement together var_d behind

CodePudding user response:

refer to 6th floor feiba7288 response:
reference 5 floor dark0oo5 reply: refer to 4th floor feiba7288 response: reference dark0oo5 reply: 3/f for this:
To achieve full word matching function of Delphi,
Such as: the select var_d, var_dd var_d_his, var_d from table, will get results var_d replaced with ss,
Select the ss, var_dd, var_d_his,...


Also not line, and that number is now just a kind of form, if I with no comma to replace? Or do not,,,

CodePudding user response:

In SQL, behind your var_d only two characters may appear? ', 'and' '(space), two replace

 StringReplace (' select var_d, var_dd, var_d_his from table ', 'var_d,', 'ss' [rfReplaceAll]); 

StringReplace (' select var_d var_dd, var_d_his from table ', 'var_d', 'ss' [rfReplaceAll]);


So that we can

CodePudding user response:

refer to the eighth floor hongss response:
in SQL inside, behind your var_d only two characters may appear? ', 'and' '(space), two replace

Delphi/Pascal code? 123 stringreplace (' select var_d var_dd, var_d_his from table ', 'var_d,', 'ss' [rfReplaceAll]); StringReplace (' select v...


Yes, SQL is to write their own, we would like to how to control how to control,

CodePudding user response:

references 9 f feiba7288 response:
reference hongss reply: on the eighth floor in SQL inside, behind your var_d only two characters may appear? ', 'and' '(space), two replace

Delphi/Pascal code? 123 stringreplace (' select var_d var_dd, var_d_his from table ', 'var_d,', 'ss' [rfReplaceAll]); Strin...


Ah, don't want to answer, I, for example, is SQL, if not? There were other ways? Mainly how to implement a full word matching, universal,,
And impossible is only the two characters, there may be a + - */=, etc.,,

CodePudding user response:

That you write a, circle characters in a string,

P ^ in [' and ', ', '+', '-' and '*'...]
To separate the keywords, then replace a keyword

CodePudding user response:

The
reference 11 floor kiboisme reply:
that you write a, circulation characters in a string,

P ^ in [' and ', ', '+', '-' and '*'...]
To separate the keywords, then replace a keyword can


Judge too much, afraid of missing, and so did ask next full word matching function,,,

CodePudding user response:

Delphi support regular?

CodePudding user response:

The select var_d var_dd, var_d_his from table,
This is very simple
nullnullnullnullnullnullnullnullnullnull
  • Related