Flipping either a string or an array horizontally

Currymunch

Member
Joined
Jan 21, 2008
Messages
13
Programming Experience
Beginner
Hope everyone is well, I was wondering if anyone knew the answer to the following;

Im looking to flip an array horizontally so that an array of characters ie -- 123 becomes 321 without using a swap (introducing temp variables that slotting in).

Another solution would be to flip the string of numbers that i'm entering in so i enter in 123 in the textbox and then it gets flipped, then i use the mod operator to get into the array later (like a sneaky method of the above)

The only way i can think of doing it thus far is using lots of if statements to find the length of the string then performing a swap function : seems rater messy.

Thanks in advance
 
VB.NET:
Dim s As String = "123"
Dim chars() As Char = s.ToCharArray
Array.Reverse(chars)
s = New String(chars)
 
Thanks so much, I'm following the course outline as much as I can but it seems really to come up short in some areas, forums these days are so useful to fill in the blanks.
 
Back
Top