Hello i am using Get text funciton to retreive a postal code. But i need to split the output. I want number saved into one variable and OSLO saved into another variable
Have you got examples of the post code? Is it always a standard format? It should be a straightforward thing to achieve
You can use substring function to achieve this.
String1 = “0107OSLO”
String2 = String1.Substring(0,4)+"- "+String1.Substring(4,4)
ITS same format, but its not same value at all time
but then i assign a static value?
I need to split the variable into two different variables thats dynamic
if it’s the same format then use substring as @Srinivasa.Reddy mentioned
String 2 = String1.Substring(0,4)
String 3 = String1.Substring(4,4)
You may need to use a replace(" ",string.empty) if there is a space in the middle too
Would that only work on static value or dynamic aswell?
If there’s always a space between the code and city you can just use string split:
postCode = inputTxt.Split(" “c).First
city = inputTxt.Split(” "c).Last
if there is space between the code and city you can split the value by whitespace and store the output in string array.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.