Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Interleave strings
Message
De
23/04/2009 15:47:14
Walter Meester
HoogkarspelPays-Bas
 
 
À
23/04/2009 13:08:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01395869
Message ID:
01396157
Vues:
82
Brilliant, that was the step that I was missing so far.

The downside is that it is now only a 40% fast than the original though..

Walter,




>>Hi Walter,
>>
>>as I understand your method mades double bytes out of both strings shift the second 8 bits right and bit connect them?
>>
>>The problem is that I not see how this will work with 10 strings ...
>>
>
>
>DIMENSION cStr[3]
>cStr[1] = "ABCDEFGHIJ"
>cStr[2] = "0123456789"
>cStr[3] = "abcdefghij"
>CLEAR
>
>cResult = 0h
>FOR K=1 TO ALEN(cStr)
>	cResult = BITOR(cResult	;
>				,REPLICATE(0h0,m.k-1) + STRTRAN(STRCONV(m.cStr[m.k],12),0h0,REPLICATE(0h0,ALEN(cStr)-1)))
>NEXT
>? CAST(RTRIM(cResult,0h0) AS M)
>
>
>>Agnes
>>>Hi Agnes,
>>>
>>>A total different approach to this problem:
>>>
>>>The following is about 10 times as fast for two strings as the earlier solution, however handling more than two strings needs some additonal logic (process them in pairs and process the result of that again)
>>>
>>>
>>>cStr1 = "ABCDEFGHIJ"
>>>cStr2 = "0123456789"
>>>
>>>cResult = CAST(BITOR(CAST(STRCONV(cStr1,12) as W),SUBSTR(CAST(STRCONV(' '+cStr2,12) as W),2)) as C(LEN(cStr1)*2))
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform