Splitting a string and returning the second value

I want to split a string and only return the second value to assign to a variable.

For example Mr John Doe, this should return John to be able to assign to a variable.

What would be the best way to do this.

Hi @duaine.b

Input=“Mr John Doe”
Output=Input.Split(" ")(1)

I hope it helps!!

OutputValue = InputString.Split(" "c)(1)

1 Like

You can use .split like this, YourString.Split(" ")(1)

Hi @duaine.b

Use this below syntax:

input = "Mr John Doe"
input.Split(" ")(1)

Hope it helps!!

Refer this

Hi @duaine.b

Try this:
“Mr John Doe”.Split(" ")(1)

Assign :splitArray = inputString.Split({" "}, StringSplitOptions.RemoveEmptyEntries)
Assign :secondValue = splitArray(1)

input=“Mr John Doe”
outputString=input.Split(" "c)(1)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.