[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] defaults for UNSTRING?



Hi John,

You can use a replace statement before the unstring to replace [tab][tab] 
with [tab][space][tab].

Don

> I'm writing an interface that reads in a rather lengthy tab 
> delimited file, and wondered if there was any way to put defaults 
> into the Unstring command.  For example, if I have John[tab][tab]
> Smith for $First $Middle $Last, I'd love it if $Middle could come 
> out as ' ' instead of null.
> 
> I wrote a procedure in an SQC that takes care of that stuff as 
> follows, but I wanted to see if any of you knew of something simpler
> that I'm missing.
> 
> ...
> 
> Unstring $File_data by $tab into $First $Middle $Last
> 
> Do Clean-String($First, $First)
> Do Clean-String($Middle, $Middle)
> Do Clean-String($Last, $Last)
> 
> ...
> 
> Begin-Procedure Clean-String($Input, :$Output)
> 
> Let $Output = ltrim(rtrim($Input, ' '), ' ')
> If IsNull($Output)
>    Let $Output = ' '
> End-If 
> 
> ...
> 
> This should work really well for a fixed length file - Do Clean-
> String(substr($file_data, 1, 30), $First) - so I'll hang onto it 
> even if you all have a better suggestion for the tab-delimited file.
> Thanks for any ideas!
> 
> -John Tucker

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users