[futurebasic] Re(2): [FB] StripSpacesFromString

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1999 : Group Archive : Group : All Groups

From: Chris Stasny <staz@...>
Date: Thu, 1 Jul 1999 12:26:39 -0500
>On 7/1/99 at 8:11 AM, mikonic@... wrote:
>
>> > I threw this function together, partly because I might need it but
>mostly
>> > for fun. Do you have any suggestions on how it can be improved?
>>
>> To make this function more universal, I would suggest turning it into
>>
>> 'Length% = FN ReplaceCharsInString (StringPtr&, searchChars$, replChars$)
>> '
>> 'Length%         the new length of the string
>> 'StringPtr&      a pointer to a pascal string
>> 'searchChars$    characters to be replaced
>> 'replChars$      replacement characters
>>                  (a value of ""(empty string) means strip
>>                 (delete) all instances of searchChars$)
>>
>> Note that LEN(searchChars$) should not have to be the same as
>> LEN(replChars$)
>>
>> With a little work one could also use FN MUNGER() to do the same thing.
>> Would an assemply line routine be faster than FN MUNGER()?
>
>MUNGER works on handles and only handles.  That said, it's not that
>difficult to use.
>
>LOCAL FN ReplaceCharsInHandle(hndl&,searchChars$,replChars$)
>   'replaces every ocurrance of searchChars$ with replChars$
>   DIM offset&
>   DO
>        offset& = FN
>MUNGER(hndl&,0,@searchChars$+1,LEN(searchChars$),@replChars$+1,LEN(replChars$))
>   UNTIL offset& < 0
>END FN
>
>- via BulkRate
>
>

Cool!

Best,

-STAZ    ~)~

http://www.stazsoftware.com  mailto:staz@...
Orders: 800-348-2623         Tech: 228-255-7085
   FAX: 228-255-7086