Smalltalk (Squeak) - String parsing
Since Smalltalk is super interactive also try browsing through the methods of e.g. ByteString and other classes and the different ways to search for methods and their implementors:



You can actually run do: and at:put: on it directly, but there's also doWithIndex: for example, which looks like it will make your second bit even simpler:

string := 'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'.
string doWithIndex: [ :char :i | (char = $T) ifTrue: [ string at: i put: $U ] ].


Now, in terms of readability, the first one is of course much easier to understand.  It's to the point and obvious even for readers with no knowledge of Smalltalk.  The second one and the example I posted aren't (or are less so at least) - they use more complex syntax and several new concepts.



If you restrict yourself to just String I think your second approach is fine though.