What is a good way to switch 2 elements in a list for a certain condition?

I have a list like following, where each is an element.

[“Name: John Courtney”] [“Sex: Male”] [“Age: 41”]

Each element is string. Sometimes, the order of the 2nd and 3rd elements (indices 1 and 2, respectively) are swapped. When this happens, I need to switch them so every person will be a consistent list. For example, if the list content is

[“Name: Mary Raynard”] [“Age: 25”] [“Sex: Female”]

it needs to be modified to

[“Name: Mary Raynard”] [“Sex: Female”] [“Age: 25”].

I want to make sure sex comes first, and then age second.
How can I do this? All I can think of is, do everything step by step like:

If (check if the list(1) starts with “age”) then
___do nothing
else{ //age is in list(1) position
___string tempAge = list(1)
___list(1) = list(2)
___list(2) = tempSex

Is this the only way? Is there any way to write the equivalent code shorter or more organized?

Not sure what the use case for this is, but would it be easier to convert your list into a dictionary? You can do this like so:

Processusvierge.zip (2,0 Ko)

Now you can access each element with MyDict("Name") to get the name or MyDict("Sex") to get the sex. You can put each of these dictionaries into a list, array, datatable, etc. as you see fit.