How to Split string with Dash
Have Numbers field like 1-2-3-4
Would like to create new hidden Fields ie. Field1, Field2, Filed3, Field4 each containing data
Field1=1
Field2=2
Field3=3
Field4=4
How to Split string with Dash
Have Numbers field like 1-2-3-4
Would like to create new hidden Fields ie. Field1, Field2, Filed3, Field4 each containing data
Field1=1
Field2=2
Field3=3
Field4=4
Hey
can you try this example?
strResult.Split("-")
inside the for each you can assing each item to your variables, or else you can assing directly like this
Field1 = yourList(0)
Field2 = yourList(1)
etc...
Regards
You can try this inassign
Newdict = str.Split({"-"},StringSplitOptions.None).ToDictionary(function(x) "Field"+x,function(x) x)
Hope this helps
Cheers
@Anil_G - Wonderful answer , that should work.
@broker - In case don’t want to create dictionary,
numbers.Split("-"c)
{ "Field1", "Field2", "Field3", "Field4" }.Zip(numberArray, Function(f, n) n).ToArray()
This expression first creates an array of the four field names, then uses the “Zip” function to combine each element of the field name array with each element of the “numberArray”, and finally uses the “Select” function to transform each combined element into a new variable.
result(0)
result(1)
result(2)
result(3)