Hi I've found a file whose text has been obfuscated by subtracting 11 from every byte. Now I want to bring it back to regular text. To do this I have to add 11 to each byte read from that file. Now, I have tried several ways to do it, and they all seemed every inefficient to me. Two examples follow
*j = 0For i = 0 To Len(RawText)str &= Chr(CByte(Asc(RawText, i) + 11)) ' either this or the following'Mid(Rawtext, i, 1) = Chr(CByte(Asc(RawText, i) + 11))Inc jIf j = 100000 Then Print i; Now j = 0EndifNext* In the first option (uncommented) I am building a new string byte by byte. In the second option (commented) I am replacing each character in place. I expected the second option to be way faster, especially because there is no need for the string to be reallocated. Nevertheless, it showed to be a snail. The first option, in spite of the fact that it grows slower and slower as the string grows, is still way faster than the second option. To me it does not make sense. Does it for you? Also, is there a faster way to do this? -- Fernando Cabral Blogue: http://fernandocabral.org Twitter: http://twitter.com/fjcabral e-mail: fernandojosecab...@gmail.com Facebook: f...@fcabral.com.br Telegram: +55 (37) 99988-8868 Wickr ID: fernandocabral WhatsApp: +55 (37) 99988-8868 Skype: fernandojosecabral Telefone fixo: +55 (37) 3521-2183 Telefone celular: +55 (37) 99988-8868 Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos, nenhum político ou cientista poderá se gabar de nada. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user