View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032076 | FPC | Patch | public | 2017-06-29 11:20 | 2017-07-08 14:02 |
Reporter | Thaddy de Koning | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | all | OS | all | OS Version | all |
Product Version | 3.1.1 | Product Build | |||
Target Version | 3.2.0 | Fixed in Version | 3.1.1 | ||
Summary | 0032076: PATCH: strutils: in operator for string in array of string | ||||
Description | This comes from a forum question. overloading the in operator to find a match in an array of string seems rather logical. string and unicodestring provided, using available routines | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 36679 | ||||
FPCOldBugId | |||||
FPCTarget | |||||
Attached Files |
|
|
strutils.in-operator.patch (1,417 bytes)
Index: rtl-objpas/src/inc/strutils.pp =================================================================== --- rtl-objpas/src/inc/strutils.pp (revision 36614) +++ rtl-objpas/src/inc/strutils.pp (working copy) @@ -46,7 +46,8 @@ Function AnsiIndexStr(const AText: string; const AValues: array of string): Integer; Function MatchStr(const AText: UnicodeString; const AValues: array of UnicodeString): Boolean; Function IndexStr(const AText: UnicodeString; const AValues: array of UnicodeString): Integer; - +Operator in (const AText: string; const AValues: array of string):Boolean;inline; +Operator in (const AText: UnicodeString; const AValues: array of UnicodeString):Boolean;inline; { --------------------------------------------------------------------- Miscellaneous ---------------------------------------------------------------------} @@ -998,6 +999,17 @@ exit(i); // make sure it is the first val. end; + +Operator in (const AText:string;const AValues: array of string):Boolean; +begin + Result := AnsiIndexStr(AText,AValues) <>-1; +end; + + +Operator in (const AText:UnicodeString;const AValues: array of UnicodeString):Boolean; +begin + Result := IndexStr(AText,AValues) <> -1; +end; { --------------------------------------------------------------------- Playthingies ---------------------------------------------------------------------} |
|
Thanks. Applied the patch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-06-29 11:20 | Thaddy de Koning | New Issue | |
2017-06-29 11:20 | Thaddy de Koning | File Added: strutils.in-operator.patch | |
2017-07-03 11:31 | Michael Van Canneyt | Assigned To | => Michael Van Canneyt |
2017-07-03 11:31 | Michael Van Canneyt | Status | new => assigned |
2017-07-08 14:02 | Michael Van Canneyt | Fixed in Revision | => 36679 |
2017-07-08 14:02 | Michael Van Canneyt | Note Added: 0101607 | |
2017-07-08 14:02 | Michael Van Canneyt | Status | assigned => resolved |
2017-07-08 14:02 | Michael Van Canneyt | Fixed in Version | => 3.1.1 |
2017-07-08 14:02 | Michael Van Canneyt | Resolution | open => fixed |
2017-07-08 14:02 | Michael Van Canneyt | Target Version | => 3.2.0 |