Hello I am trying to get everything before the parentheses. What i did was split the string by spaces ( " "). How would I retrieve everything except the last element in the array
Transformers: The Last Knight (2017)
Thanks
Hello I am trying to get everything before the parentheses. What i did was split the string by spaces ( " "). How would I retrieve everything except the last element in the array
Transformers: The Last Knight (2017)
Thanks
See this below workflow,
DivideStringSpace.xaml (8.5 KB)
Hi @aj52,
For this you can use take method on your array variable (like given below).
arrSTR = arrSTR.Take(arrSTR.Count - 1).ToArray()
here,
arrSTR β> is of type Array of String.
arrSTR.Take(arrSTR.Count - 1).ToArray() β> itβll count items in a arrayVar and take out last item out of the array.
And using String.Join you can make 1 string of all items in array.
str1 (String) = String.Join(" ",arrSTR)
Note. you can use different separator. here Iβve used " " (one blank space).
Hi @aj52,
Simple.
newStrVar= yourString.replace(yourString.split(" βC)(yourString.split(β βC). length-1),β")
It will remove the last item (2017) from the string.
Hope this will work for you!
Thanks!