Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

wispoxy
en respuesta a: lee_pellegrin5UBS5

If you have a string like "Test1|test2|test3|test4" and you want to access a specific “Test#” value, you can do so by splitting the string by the “|” character and then accessing the index of the desired value.

Here’s an example in Python:

 

ssm_variable = "Test1|test2|test3|test4"
values = ssm_variable.split("|")

# To get "Test1"
print(values[0])

# To get "test2"
print(values[1])

# To get "test3"
print(values[2])

# To get "test4"
print(values[3])

 

In this code, split("|") breaks the string into a list where each element is a substring between the “|” characters. The print(values[i]) line then prints the value at index i of the list (remember that list indices in Python start at 0).

 

You can replace the index with the specific index of the “Test#” value you want to access. For example, if you want to get “test2”, you would use values[1] because “test2” is the second value in the list, and list indices start at 0.

 

Please replace the index with the one you need. If you’re using a different programming language, the concept will be similar but the syntax might differ. Let me know if you need help with a different language! :cara_que_sonríe_con_ojos_sonrientes: