Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Plugin: Filterplus

Apr
393
13
I’ve written a small plugin to overcome my frustrations from using the @FILTER function in TCC. It’s possible no one else finds it frustrating (or possibly no one else uses @FILTER!), but I thought I’d offer it for download in case it’s helpful to other users.

For those not familiar with it, @FILTER extracts the requested characters from the supplied string. For example, to extract just the digits from a string you use it like this:
Code:
d:\>echo %@filter[0123456789,ABC123.45abc]
12345

Extracting alphabetic characters requires you to type the entire alphabet twice, once in upper case and once in lower case:
Code:
d:\>echo %@filter[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghujklmnopqrstuvwxyz,ABC123.45abc]
ABCabc


My plugin, called FilterPlus, allows the use of shortcuts to represent some common sequences of characters. To extract just the digits as in the previous example, the shortcut “~d” is available:
Code:
d:\>echo %@filter[~d,ABC123.45abc]
12345

and for alphabetic characters ~A means a lot less typing and less chance of a typo:
Code:
d:\>echo %@filter[~A,ABC123.45abc]
ABCabc

The other shortcuts available are

~D - extracts digits and the decimal character as defined in the user locale:
Code:
d:\>echo %@filter[~D,ABC123.45abc]
123.45

~l - extracts lowercase alphabetic characters:
Code:
d:\>echo %@filter[~l,ABC123.45abc]
abc

~U - extracts uppercase alphabetic characters:
Code:
d:\>echo %@filter[~U,ABC123.45abc]
ABC


I’m afraid the plugin is only available as a 64-bit version as I have no longer have any means of testing 32-bit plugins.

If anyone would like to try the plugin it can be downloaded from this dropbox location. If you do find it a useful plugin, please reply in this thread and I’ll ask Rex to add it to those available on the JP Software website.
 
Nice plugin

pure tcc code example of how to
Code:
set U_alpha=65 66 67 68 69 70 71
set L_alpha=97 98 99 100 101 102 103

    echos %@filter[%@char[%U_alpha %L_alpha] 0123456789,ABCDEFG123.45abcde]
 
Last edited:
Hi @RogerB,
Would you please edit the title of this thread to include the name of your plugin, perhaps New Plugin: FilterPlus

That way, folks can see at a glance what plugin is being discussed in the thread.

FilterPlus will be very useful for me.

Joe
 

Similar threads

Back
Top