Splitting strings complicated

I have a String like this
“Enschede
7514 CB
H.B. Blijdensteinlaan 18
Netherlands”
The only things I need in this string are: H.B. Blijdensteinlaan 18 so this is line 3 (always line 3) now i want to put everything till the number in one variable and the number in one variable.
So i need this:
Variable 1: Streetname: “H.B. Blijdensteinlaan”
Variable 2: Housenumber: “18”

Hi @438654,
You can achieve this using vb code… Here is the code

    Dim StringNeeded As String = String.Empty
    Dim numberNeeded As String = String.Empty
    Dim Address As String = String.Empty
   Dim TextLine As String
    Dim countOfLinesInFile As Integer = 0

    Do While objReader.Peek() <> -1
        TextLine = objReader.ReadLine() & vbNewLine
        countOfLinesInFile = countOfLinesInFile + 1

        If countOfLinesInFile = 3 Then
            StringNeeded = TextLine
            For Each c As Char In StringNeeded
                If IsNumeric(c) Then
                    numberNeeded = numberNeeded & c
                End If
           Next
           Address = StringNeeded.Replace(numberNeeded, "")
        End If
    Loop

hello @438654
1)assign string into array of string.
2) get 3rd index then
3) iterate through for loop and check condition current char is number or not
if number is found then break into two part and assign two different varaible

thanks

Hi @438654,
You can also use regex like this:
Variable 1: regex101: build, test, and debug regex
Variable 2: regex101: build, test, and debug regex

the variable is read from an excel file. So the length of line 3 that i need is never the same.

how i am able to assign the string into an array string?

@HareeshMR it seems like this is the solution but it’s hard to implement when it’s code

@438654, let me know what are the issues you are facing while using the code. Simply use Invoke code activity to place the code in the workflow. You need to store the text in a txt file before reading it in the code.
And sorry, i have missed this line there:
Dim objReader As New System.IO.StreamReader(“D:\UIPath files\Time sheets\Attachments\Deepfieldglass.txt”)…

Give your own path.

If you feel difficult in writing the string to a txt file, you can directly pass the entire string in the arguments.

Hope this helps.

String stringArr = str.split(" \n");

i do not understand

i do not understand…

Here is the file, all you need is change the path in the file and copy the invoke code activity from this and place it in your workflow where you need.
Main.xaml (4.7 KB)

I wanna thank you for trying to help but i don’t need/want code. Really need just the visual stuff. Thats why i said i don’t understand.

Visual stuff?

What is that? Explain a bit

like this

Just open the file i have attached, you will see the same :smile:

Thats weird because i get this:

I don’t know what you are expecting, instead of using existing activities, we are just writing a piece of code to read the file and get the required data. If you want to achieve the same using activities, please leave all the above stuff and carry on. I don’t know what’s weird there :slight_smile: and all the best

I know it’s normal like you do. But like I said I need it in Activities. I am sure the code works but i am not able to convert it to activities bc i just don’t understand it.

I simply don’t understand why you stick on to activities if we have the Invoke code activity readily available. May be I don’t know your requirement. And simply, I quit