Lazarus

Programming => General => Topic started by: Bazzao on September 14, 2017, 03:43:23 am

Title: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 03:43:23 am
Has anyone developed, know of a source or, a LIKE function for Pascal similar to VBA's LIKE Operator?

LIKE operator reference:
https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator

The Pattern Options I am particularly interested in are (apart from the usual wilds * and ?), are
# Any single digit (0–9)
[charlist]   Any single character in charlist
[!charlist]   Any single character not in charlist

I have looked at the IsWild function, and as it stands, it is not suitable.

TIA

Bazza
Title: Re: LIKE operator for Pascal
Post by: Edson on September 14, 2017, 03:59:45 am
I use this function:

Code: Pascal  [Select][+][-]
  1. function StringLike(const str: string; mask: string): boolean;
  2. {Utilidad para comparación de cadenas al estilo de VB. El patrón de comparación es
  3. "mask" y tiene los siguientes comodines:
  4. '?' -> coincide con cualquier caracter.
  5. '*' -> coincide con cualquier texto.
  6. '#' -> coincide con cualquier caracter numércio.
  7. '[]' -> indica un conjunto de cacacteres.
  8. }
  9. var
  10.   msk: TMask;
  11. begin
  12.   mask := StringReplace(mask, '#', '[0-9]', [rfReplaceAll]);
  13.   msk := Tmask.Create(mask);
  14.   Result := msk.Matches(str);
  15.   msk.Destroy;
  16. end;
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 04:06:57 am
Running that thru Google translator makes it look even better (looked good in Spanish).

I'm going to give that a go.

Thanks,

B
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 04:42:02 am

Trialling out the function, i am running a few tests, looking at the same string (random co-ordinate in Degrees Minutes Seconds), with different masks. All should be true, satisfying the proper calls..

Output shows:
Quote
N 10 32 29 W 47 4 21>> [NSEW]?[0-9]*[NSEW]?[0-9]*= FALSE
N 10 32 29 W 47 4 21>> [NSEW]?[0-9]*= FALSE
N 10 32 29 W 47 4 21>> [NSEW]*[0-9]*= FALSE
N 10 32 29 W 47 4 21>> [N,S,E,W]?[0-9]*[N,S,E,W]?[0-9]*= FALSE
N 10 32 29 W 47 4 21>> [N,S,E,W]?[0-9]*= FALSE
N 10 32 29 W 47 4 21>> [N,S,E,W]*[0-9]*= FALSE

The objective is to test for
Hemisphere (N/S/E/W) then digit then Hemisphere (N/S/E/W) then digit. This would confirm a possible full co-ordinate.

Code: Pascal  [Select][+][-]
  1. program StringLike1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes, Masks, SysUtils, crt
  10.   { you can add units after this };
  11.  
  12. {$R *.res}
  13.  
  14. var
  15.   ch:char;
  16.  
  17. function StringLike(const str: string; mask: string): boolean;
  18. {Utility for VB style string comparison. The pattern of comparison is
  19. "mask" and has the following wildcards:
  20. '?' -> matches any character.
  21. '*' -> matches any text.
  22. '#' -> matches any numeric character.
  23. '[]' -> indicates a set of cacacters.
  24. }
  25. var
  26.   msk: TMask;
  27. begin
  28.   mask := StringReplace(mask, '#', '[0-9]', [rfReplaceAll]);
  29.   try
  30.     msk := Tmask.Create(mask);
  31.   except
  32.     on E: Exception do
  33.       writeln('ERROR 1: ',E.Message);
  34.   end;
  35.   try
  36.     Result := msk.Matches(str);
  37.   except
  38.     on E: Exception do
  39.       writeln('ERROR 2: ',E.Message);
  40.   end;
  41.   try
  42.     msk.Destroy;
  43.   except
  44.     on E: Exception do
  45.       writeln('ERROR 3: ',E.Message);
  46.   end;
  47. end;
  48.  
  49. procedure Test0(pStr,pMsk:string);
  50. begin
  51.   writeln(pStr,' ',pMsk,' ',StringLike(pStr,pMsk));
  52. end;
  53.  
  54. procedure Test1;
  55. begin
  56.   Test0('N 10 32 29 W 47 4 21','[N,S,E,W]?[0-9]*[N,S,E,W]?[0-9]*');
  57.   Test0('N 10 32 29 W 47 4 21','[N,S,E,W]?[0-9]*');
  58.   ch:=readkey;
  59.   if ch=#27 then writeln;
  60. end;
  61.  
  62. begin
  63.   Test1;
  64. end.
  65.  

B

Title: Re: LIKE operator for Pascal
Post by: bytebites on September 14, 2017, 05:13:01 am
Code: Pascal  [Select][+][-]
  1.  msk := Tmask.Create(mask,true);

Change the mask to case sensitive.
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 05:27:01 am
Well that's a result.

Thanks bytebites.

B
Title: Re: LIKE operator for Pascal
Post by: Akira1364 on September 14, 2017, 05:40:03 am
I use this function:

Code: Pascal  [Select][+][-]
  1. function StringLike(const str: string; mask: string): boolean;
  2. {Utilidad para comparación de cadenas al estilo de VB. El patrón de comparación es
  3. "mask" y tiene los siguientes comodines:
  4. '?' -> coincide con cualquier caracter.
  5. '*' -> coincide con cualquier texto.
  6. '#' -> coincide con cualquier caracter numércio.
  7. '[]' -> indica un conjunto de cacacteres.
  8. }
  9. var
  10.   msk: TMask;
  11. begin
  12.   mask := StringReplace(mask, '#', '[0-9]', [rfReplaceAll]);
  13.   msk := Tmask.Create(mask);
  14.   Result := msk.Matches(str);
  15.   msk.Destroy;
  16. end;

↓↓↓ MFW you call Destroy directly and not Free ↓↓↓
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 05:52:12 am
Noted Akira1364.

The next issue is some DMS indicate hemisphere with a negative (S or W)

If I add

  Test0('-123 45.678','[-#]## #*');

I get an execution error.

Similarly with

  Test0('-123 45.678','[-0123456789]## #*');

How do I test for hyphen along with digits (remember first may be positive or negative)?

The only way I can see is to test via character independently.

I am getting only a few results searching for pascal TMask.

B

Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 14, 2017, 10:25:45 am
Also, another question ...

Instead of creating and freeing every match, can I create upon program initialization and free upon termination. A look at the popup list for TMask did not reveal anything I am sure of.

B
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 14, 2017, 02:17:31 pm
I upload modified version of masks-file.
No need to use string replace function.
Create tmask-instance for each mask-string.

Code: Pascal  [Select][+][-]
  1. uses masks2;
  2.  
  3. var
  4.   msk: TMask;
  5. begin  
  6.   msk := Tmask.Create('-123 45.678');
  7.   Result := msk.Matches('{/-}### ##.###');
  8.   msk.free;
  9. end.
  10.  
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 14, 2017, 02:45:48 pm
I fiddled this together, which is like, like VB syntax.
- Uses some code from swiss delphi center
- Uses macro for like
- Uses (or mis-uses) operator overload ><
Then you get this ;) :
Code: Pascal  [Select][+][-]
  1. program test;
  2. {$mode objfpc}{$H+}
  3. {$macro on}{$define like:=><}
  4. uses sysutils, strutils;
  5.  
  6. operator ><(const source,pattern:string):boolean;overload;
  7. var
  8. // source is from matchstrings function swissdelphicenter
  9.   pSource: array [0..255] of Char;
  10.   pPattern: array [0..255] of Char;
  11.  
  12.   function MatchPattern(element, pattern: PChar): Boolean;
  13.  
  14.     function IsPatternWild(pattern: PChar): Boolean;    
  15.     begin
  16.       Result := StrScan(pattern, '*') <> nil;
  17.       if not Result then Result := StrScan(pattern, '?') <> nil;
  18.     end;
  19.   begin
  20.     if 0 = StrComp(pattern, '*') then
  21.       Result := True
  22.     else if (element^ = Chr(0)) and (pattern^ <> Chr(0)) then
  23.       Result := False
  24.     else if element^ = Chr(0) then
  25.       Result := True
  26.     else
  27.     begin
  28.       case pattern^ of
  29.         '*': if MatchPattern(element, @pattern[1]) then
  30.             Result := True
  31.           else
  32.             Result := MatchPattern(@element[1], pattern);
  33.           '?': Result := MatchPattern(@element[1], @pattern[1]);
  34.         else
  35.           if element^ = pattern^ then
  36.             Result := MatchPattern(@element[1], @pattern[1])
  37.           else
  38.             Result := False;
  39.       end;
  40.     end;
  41.   end;
  42. begin
  43.   StrPCopy(pSource, Source);
  44.   StrPCopy(pPattern, pattern);
  45.   Result := MatchPattern(pSource, pPattern);
  46. end;
  47.  
  48. begin
  49.   if 'Sean Stamley' like 'Sean*' then writeln('Match'); // there you go! like in FreePascal
  50. end.
  51.  

Code works... Don't take it seriously, though. It is more like "just because I can" code.. ::) :D
Alternatively you can overload the in operator with the same code or use >< like I wrote it. The macro is just for the keyword like...

(original sdc code from here http://www.swissdelphicenter.ch/en/showcode.php?id=307 needs some touches, though)

Note I overloaded "symmetric difference" ><, because "contains" (<=) is already overloaded for strings and in will be soon (partially done in trunk). see:
Code: Pascal  [Select][+][-]
  1. var
  2.   s:array[0..1] of string = ('Sean','Bean');
  3. begin
  4.   if 'Sean' <= 'ea' then writeln('Match');
  5.   if 'Sean' in  s then writeln('Match');
  6. end.
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 14, 2017, 05:25:55 pm
Ok. rethink and proof of concept. Why not have code like this?:
Code: Pascal  [Select][+][-]
  1. var s:Ansistring  =  'Sean Boon';
  2. begin
  3.   writeln('Sean Bean'.Like('S*an?B*'));
  4.   writeln(S.Like('SA*an?B*'));
  5. end.

All we need is a little type helper, like this:
Code: Pascal  [Select][+][-]
  1. type
  2.   TLikeHelper = type helper for AnsiString
  3.   function Like(const Pattern:AnsiString):Boolean;
  4.   end;

Now that's quite neat, isn't it?
With the help of the (not really nice) code from the above swiss delphi center example that becomes something like:
Code: Pascal  [Select][+][-]
  1. program test2;
  2. {$mode objfpc}{$H+}{$modeswitch typehelpers}
  3. uses sysutils;
  4. type
  5.   TLikeHelper = type helper for AnsiString
  6.   function Like(const Pattern:AnsiString):Boolean;
  7.   end;
  8.   function TLikeHelper.Like(const Pattern:AnsiString):Boolean;
  9.  
  10.   function MatchPattern(element, pattern: PChar): Boolean;
  11.  
  12.     function IsPatternWild(pattern: PChar): Boolean;    
  13.     begin
  14.       Result := StrScan(pattern, '*') <> nil;
  15.       if not Result then Result := StrScan(pattern, '?') <> nil;
  16.     end;
  17.   begin
  18.     if 0 = StrComp(pattern, '*') then
  19.       Result := True
  20.     else if (element^ = Chr(0)) and (pattern^ <> Chr(0)) then
  21.       Result := False
  22.     else if element^ = Chr(0) then
  23.       Result := True
  24.     else
  25.     begin
  26.       case pattern^ of
  27.         '*': if MatchPattern(element, @pattern[1]) then
  28.             Result := True
  29.           else
  30.             Result := MatchPattern(@element[1], pattern);
  31.           '?': Result := MatchPattern(@element[1], @pattern[1]);
  32.         else
  33.           if element^ = pattern^ then
  34.             Result := MatchPattern(@element[1], @pattern[1])
  35.           else
  36.             Result := False;
  37.       end;
  38.     end;
  39.   end;
  40. var
  41. // source is adapted from matchstrings function swissdelphicenter
  42.   pSource, pPattern: PAnsiChar;
  43. begin
  44.   pSource :=AllocMem(Length(Self));
  45.   pPattern := AllocMem(Length(Pattern));
  46.   StrPCopy(pSource, Self);
  47.   StrPCopy(pPattern, pattern);
  48.   Result := MatchPattern(pSource, pPattern);
  49.   Freemem(pSource);
  50.   FreeMem(pPattern);
  51. end;
  52.  
  53.  
  54. begin
  55.  writeln('Sean Bean'.Like('SA*an?B*'));
  56. end.

Now all we have to do is improve on the code (I did, but even more). but the principle is ok and can be added to sysutils.TStringhelper when finished.
Note you could replace the internal code with the code from Edson... much better... but that can not be added to sysutils because it depends on masks.
I'll see if I can factor out the masks code, or add this helper to masks (or even rexexpr)



Title: Re: LIKE operator for Pascal
Post by: sam707 on September 15, 2017, 01:59:29 am
{$mode smartass ON}
I guess that both regex and regexpr FPK units would already do the job in a way, standartized for decades.

I did not use Qt QValidadator for long, but if I remember, it has a 3-states result possibility, where boolean is not enough, LIKE (matched,unmached, partial), plus a possible callback on expressions failures (partials), called with indices

so... infinite solutions are available by using what exists in regular expressions Standard, and coding a little bit, depending wanted flavor.

Knowing that, the need to become part of sysutils is then very relative  :D

or maybe its my... how you said? lack of knowledge HAHAHAHAHAH  >:D

I love grumpies but I still prefer shrimpies  :P
{$mode smartass OFF}
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 15, 2017, 08:10:10 am
You can use RexExpr as the underlying engine for the operator or the typehelper ..... As I wrote. It is more syntax.
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 16, 2017, 03:22:29 am
I upload modified version of masks-file.
No need to use string replace function.
Create tmask-instance for each mask-string.

Thanks bytebites,

I tried the usual \- and other normal ways of quoting a reserved character..

Yet to give your input a go, but looks like it will work.

Hopefully I can find file uploaded.

Bazza
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 16, 2017, 03:26:44 am
Thanks for the code Thaddy. Will look at it, although the TMask code is working (still to place the hyphen - I am busy replying).

B
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 16, 2017, 03:48:10 pm
I upload modified version of masks-file.

Quote
masks2.pas(380,10) Error: Illegal expression

Error points to:
    I++;   

Arr me laddie, that be C coding if I am not mistaken.
Should it be
  Inc(I,1)?

B
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 16, 2017, 09:07:02 pm
Inc(I,1) or Inc(I).
My customized compiler understands i++ and i--. 
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 17, 2017, 04:47:45 am
I upload modified version of masks-file.
No need to use string replace function.
Create tmask-instance for each mask-string.

Code: Pascal  [Select][+][-]
  1. uses masks2;
  2.  
  3. var
  4.   msk: TMask;
  5. begin  
  6.   msk := Tmask.Create('-123 45.678');
  7.   Result := msk.Matches('{/-}### ##.###');
  8.   msk.free;
  9. end.
  10.  

Arrr me laddie. You be had the strings the wrong way. No wonder the ship wouldn't sail.

But swapped properly and decustomised  ;)  it works.

Inc(I,1) or Inc(I).
My customized compiler understands i++ and i--.

That silly language. Full of squiggly worms wiggling around "void"s.  :D

Give me a manly begin ... end any day.

Many thanks for your help.

Bazza


Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 17, 2017, 05:55:44 am
I tried to add a new procedure to update the mask, using the same process as Create.

Code: Pascal  [Select][+][-]
  1. procedure TMask.UpdateMask(const AValue: String; const CaseSensitive: Boolean=true);
  2. begin
  3.   fInitialMask := AValue;
  4.   fCaseSensitive := CaseSensitive;
  5.   InitMaskString(AValue, CaseSensitive);
  6. end;

However I was unsuccessful.

Oh well. I have to [re]learn about classes.

B


Save creating / destroying the mask every time.

Bazzao

Title: Re: LIKE operator for Pascal
Post by: bytebites on September 17, 2017, 08:59:28 am
Perhaps clear previous mask? Not tested.

Code: Pascal  [Select][+][-]
  1. procedure TMask.UpdateMask(const AValue: String; const CaseSensitive: Boolean=true);
  2. begin
  3.   ClearMaskString;
  4.   fInitialMask := AValue;
  5.   fCaseSensitive := CaseSensitive;
  6.   InitMaskString(AValue, CaseSensitive);
  7. end;

CaseSensitive=false should work too. There was bug in the original mask-file that it didn't.

I agree about C-language, but in this case c-style inc is easier to write than pascal inc.
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 20, 2017, 03:22:01 am
The error is a class issue. Something about only known procedures & functions.

So compile is not successful.

B
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 20, 2017, 08:57:58 am
Inc(I,1) or Inc(I).
My customized compiler understands i++ and i--.
Well, last time (2 years ago) I submitted a request for that it was refused. Not only for language reasons, but also technical.
If you have it working, why not submit a patch? This looks more like a "The Donald Tweet" to me, to be frank. :P
Title: Re: LIKE operator for Pascal
Post by: fred on September 20, 2017, 01:47:54 pm
There is something in between, the += operator as in i += 1;
https://www.freepascal.org/docs-html/3.0.2/prog/progsu10.html (https://www.freepascal.org/docs-html/3.0.2/prog/progsu10.html)
I have used += a lot in C but never in Pascal :)
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 20, 2017, 04:44:18 pm
There is something in between, the += operator as in i += 1;
https://www.freepascal.org/docs-html/3.0.2/prog/progsu10.html (https://www.freepascal.org/docs-html/3.0.2/prog/progsu10.html)
I have used += a lot in C but never in Pascal :)
Short answer : I was referring to that, long answer:
Yes, that's why I asked to implement the reverse order as well (=+, increment after use and the likes) It was refused.
Actually I agreed with that decision, because it is easy to do yourself and the source is more readable.
Note increment/decrement/multiply/divide AFTER use are completely different beasts from a compiler perspective:
It is *a lot* more difficult to implement, since initial state needs to be preserved until after the initial operation.
And e.g. that operation can be lengthy.
That's harder to do in what is basically still a single pass compiler (it isn't quite a single pass compiler anymore, but anyway it still has the characteristics ).
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 20, 2017, 06:58:30 pm
i++; i--; attached.

Breaks code. i++2 causes error.

Send it to Trump or whatever.

File removed to avoid more disappointments.
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 20, 2017, 08:35:12 pm
That's not what was asked..
+= increment before use
=+ increment after use
Etc.
++ and -- are already covered by for to and for downto.
Increment after use in your patch doesn't work. Not in for to and not in for downto.
I reverted the patch.
Plz IF you create a compiler patch, make sure it works AND fails as intended. In this case make sure it works like its C equivalent.
Make sure it can not overflow and underflow.
What is your intended code? I don't see the point with your patch. Examples? What works? I can only show it doesn't work:
Code: Pascal  [Select][+][-]
  1. // very basic fail:
  2. var i:integer = 0;
  3. begin
  4. while i < 10 do
  5.  writeln(i++); // should be 0..9
  6. i := 0;
  7. while i < 10 do
  8.  writeln(++i); //should be 1..10
  9. end.
And what is the equivalent for
Code: C  [Select][+][-]
  1. for(i=0;i<10;i++){printf("i");};
  2. for(i=0;i<10;++i){printf("i");};

Now please explain if your patch actually does anything?.. useful...<grumpy... >:D>

The patch is harmless for one try if someone wants to test it, but revert it immediately after the test... 8-) O:-)
I did, see test code.
It is utter nonsense because it is not thought through and poorly implemented if at all sound.
More basic fail:
Code: Pascal  [Select][+][-]
  1. // very basic fail 2:
  2. var i:integer = 0;
  3. begin
  4. while i++ < 10 do
  5.  writeln(i); // should be 0..9
  6. i := 0;
  7. while ++i < 10 do
  8.  writeln(i); //should be 1..9! // 9 not 10
  9. end.

Does not work, does it? ;D >:(

Mind you, I want all of this to work, but it is far more complex to implement than your try and than you think. Try again.... :D
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 21, 2017, 07:16:03 am
Sorry to hear that you was disappointed  >:D
In this way it was designed to work. You can write inc(i) instead of it.
Code: Pascal  [Select][+][-]
  1. var i:integer = 0;
  2. begin
  3. while i < 10 do begin
  4.  writeln(i); // should be 0..9
  5.  i++;
  6. end;
  7. i := 0;
  8. while i < 10 do begin
  9.  i++;
  10.  writeln(i); //should be 1..9! // 9 not 10
  11. end;
  12. end.
Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 21, 2017, 08:35:37 am
Well, a simple replacement for inc()/dec() has imho little real value.
I encourage you to implement it properly. (Difficulty between 1..10 is 11, though).
It is a feature I requested at least 2 times in the past years, both requests were rejected.
I still think a full implementation is a highly desirable feature. See my test examples why I think so.
So a full set of use then modify, modify then use etc. Note: use then modify is the culprit.
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 21, 2017, 01:36:22 pm
Code: C  [Select][+][-]
  1. #include <stdio.h>
  2. int main(void)
  3.         {
  4. int i=0;
  5. while (i++<10)
  6.   printf("%d\n",i);
  7. return 0;
  8. }

Prints numbers 1-10.

Code: C  [Select][+][-]
  1. #include <stdio.h>
  2. int main(void)
  3.         {
  4. int i=0;
  5. while (++i<10)
  6.   printf("%d\n",i);
  7. return 0;
  8. }

Prints numbers 1-9.
Java does the same.
And now Pascal:

Code: Pascal  [Select][+][-]
  1. program inctest;
  2.  
  3. {$mode delphi}
  4.  
  5. function preinc(var i:integer):integer;inline;
  6. begin
  7.   inc(i);
  8.   result:=i;
  9. end;
  10.  
  11. function postinc(var i:integer):integer;inline;
  12. begin
  13.   result:=i;
  14.   inc(i);
  15. end;
  16.  
  17. var i:integer;
  18. begin
  19.   writeln('i++ simulation');
  20.   i:=0;
  21.   while postinc(i)<10 do
  22.     writeln(i);
  23.  
  24.   writeln('++i simulation');
  25.   i:=0;
  26.   while preinc(i)<10 do
  27.     writeln(i);
  28.  
  29. end.

Title: Re: LIKE operator for Pascal
Post by: Thaddy on September 21, 2017, 02:17:00 pm
That's obvious and we all know how to do that! You suggested you had a patch that introduced proper ++. You didn't.
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 21, 2017, 02:34:22 pm
Really? Where?
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 22, 2017, 02:06:11 am
Ok Thaddy & bytebites, please calm down.

This is MY topic.

All this discussion and code snippets is very useful, but it all comes down to the fact that others out there, members of the forum or not, beginners or not, will grab published code and expect it to run and be frustrated by compilation errors generated from unsupported code. And it is too easy to forget to replace unsupported code by supported prior to posting.

Please continue, because I am learning ...

My 2c.

Bazza
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 22, 2017, 08:16:47 am
Thanks for your patience.

C-style inc-patch.
Title: Re: LIKE operator for Pascal
Post by: Bazzao on September 25, 2017, 04:35:44 am
I have yet to look at your attachment, because I have been busy finalising the match.

Yes I stuffed up a bit trying to add the Update mask, but found out why.

I ran my DMS conversion (transported from VBA) to pascal, and for full earth coordinates, using about 16 matches per co-ordinate, the mask2 variation worked ...

Quote
TestUntilKeypressed:
11388719 tests.
This is under development. C:\>

At 11388719 * <=> 16 tests you don't want to keep creating and destroying.

Anyway I now have single formatted (N 23 34' 56") and single unformatted (23 34 56) to test.

B
Title: Re: LIKE operator for Pascal
Post by: bytebites on September 25, 2017, 07:47:39 am
Code: Pascal  [Select][+][-]
  1. var
  2.   masks :array [1..16] of tmask;

TinyPortal © 2005-2018