How to reverse an Array of Strings?

Hi,

I’m developing a sequence in which I have to reverse the order of an Array. Basically, I have an InputDialog that accepts any number of Strings you provide and I save them in a variable. After that, I create another String variable but this time in the form of an Array. I basically do this: sWordsSplited = Split(sWords," ")

My goal now is to reverse that sWordsSplited variable. I keep finding on internet some information about the Array.Reverse method but so far, I haven’t found a way to proper use that syntax.

I tried for example an Assign like this: arrReverseWords = Array.Reverse(sWordsSplited) or like sWordsSplited.Reverse(sWordsSplited) and so far, I still haven’t found the correct syntax to proper use this method. Anyway, if there’s other ways… feel free to share.

Any tips?

Have you read this:

?

@moreirasa1 Try below method.

new arrayvariable=oldarrayvariable.Reverse().ToArray

3 Likes

@Manjuts90 That’s it, thanks. I was near the solution all the time but I never used the ToArray notation after Reverse() as I thought that since I was making an Assign to an array variable, I would just need something like: arrStringWords = sWordsSplited.Reverse

2 Likes