Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing extra spaces in MIDDLE of str.
Message
 
 
À
25/07/2001 21:55:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00535205
Message ID:
00535491
Vues:
19
>>>>>how about this
>>>>>
>>>>>thistemp = 'Iain           Brodie'
>>>>>? subs(thistemp, 1, at(' ', thistemp)-1)+' '+subs(thistemp, rat(' ',thistemp)+1)
>>>>>
>>>>
>>>>Hi Iain,
>>>>
>>>>Just check reduce function from FoxTools (which, of course, needs to be loaded first). So, it's a one line of code: lcString=reduce(m.lcString) :)
>>>What about this:
>>>
abc = STRTRAN(abc, ' ', '')
>>>
>>>Mark
>>
>>That's not enough, since you transformed all two spaces into one space. You should call this function recursively. What's wrong in your opinion with FoxTools library? You don't have to re-invent the wheel. Some of the functions in FoxTools, though, might be written in not 100% efficient way (say, we have a discussion with Cetin about two years ago about FoxTools Words and WordNum functions and their unefficiency for huge texts).
>>
>>BTW, I believe Dragan Nedeljkovich had written this "reduce" function quite recently in one of the threads. Unfortunately, I don't remember specifics...
>
>No, that's not true. This will replace all the spaces with nothing (second parameter)
>
>Mark

So, you would end with MarkGoldin. I'm not sure, this is what you want :)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform