Quantcast
Channel: Transposing characters in a string - Code Review Stack Exchange
Browsing latest articles
Browse All 2 View Live

Answer by Shepmaster for Transposing characters in a string

If it's just ASCII, treat it as a byte array all the way until the end. Vec has a swap method and you can reconstruct a String from the bytes.Use map and collect instead of allocating a Vec and...

View Article



Transposing characters in a string

I want to create a function that takes a string and returns an array of versions of it in which always one pair of characters is transposed (swapped).I came up with this:fn transposes(s: &str)...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images