filtering non-alphanumeric chars in processing
Bruce Easton
bruce at stn.com
Thu Feb 26 11:21:37 PST 2015
Yeah, that was one option I was considering and may yet test for runtime
efficiency. The requirement turned out to be a little different in the
end though. What was needed was not squishing, but to replace the
non-alphanumeric with a space as it gets fed to the output string. For
now, I'm testing with a simple edit assignment:
Then: an(1,alnum)=x
Then: x=an 'should get original char (even if space), or space
from edit failure
Bruce
On 2/26/15 1:35 PM, Scott Nelson wrote:
> Test each character for it's ascii value v the desired range:
>
> ::l="'1"
> loop:l eq "100":end
> ::c=mid(f,l,"1");d=asc(c)
> :(d ge "48" and d le "57") or (d ge "65" and d le "90") or (d ge "97"
> and d le "122"): do something to keep this digit
> ::: or do something else
> :::l=l+"1";goto loop
>
>
> Scott
>
>
>
>
> On 02/26/2015 12:03 PM, Bruce Easton wrote:
>> I need to filter out (squish out) non-alphanumeric characters from
>> small array-element strings in processing for a large amount of data.
>>
>> Since I am already having to, for other purposes form each string
>> character by character, I'm wondering which might be more efficient
>> at runtime (or if there would even be any noticeable difference).
>>
>> For each character, I could test its inclusion in the desired ascii
>> range using the asc() function;
>> or for each, I could set an "okstring" to "0123...9abc...z" and then
>> test if the char is contained in said okstring;
>> or for each, I could apply the char to a dummy with the alnum edit
>> and then test if the dummy is left blank.
>>
>> Just wondering out loud. I haven't tried any of these against a
>> large data set - but ultimately this will be used for such, so I
>> should soon know. I have a feeling testing against the edit result
>> might be the most efficient.
>>
>> Bruce
>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
>>
>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
More information about the Filepro-list
mailing list