I want to extract specific string from a text file.
I have tried 2 methods but struck on same point:
I have read the text file and saved data in form of list of string type.
I have read text file and saved data in a single string variable using ReadLine.
My problem is how to get index of specific words from string or list so that I can use substring method to get substring containing data between specific words.
I am using IndexOf to get index of that word but everytime I am getting 0 as result.
please help.
Dim St As String = “string pulled from the text file using reader which has key : text I want to keep - end of my string”
Dim pFrom As Integer = St.IndexOf("key : ") + "key : “.Length
Dim pTo As Integer = St.LastIndexOf(” - ")
Dim result As String = St.Substring(pFrom, pTo - pFrom)
Note: “key :” and " -" are the two strings of the string’s starting and end which we need to search and get.
we can return the result to the workflow and can use it
Attaching a sample .xaml file for your reference. I have used invoke code activity which accepts “from” and “to” strings as input arguments. You can change them and check as per your need.
Prakshi - I tried to follow your example of finding text between strings using an invoke code approach. While I was able to add the code, I am getting an error message as follows and oddly the “invoke code” activity is red not black like the other activities in the list. I am attaching some screen shots as well. Thank you so much for your help! Kim
Here is the error message:
No compiled code to run
Error BC30451 ‘strPDF’ is not declared. It may be inaccessible due to its protection level. At line 1Error Message.xlsx (94.4 KB)
Hi Arive
i follow your Instraction to extract data between the string, if we extract the data from some line in string
like…
010 Silicon hoses shiny glossy blue L
bend 90 deg reducer 1.5 to 1.25
inches
25.00 piece
Requested delivery period from 1 9/06/2018 til l 22/06/2018020 Silicon hoses shiny glossy blue L
bend 90 deg reducer 2.5 to 2 inch
20.00 piece
Requested delivery period from 1 9/06/2018 til l 22/06/2018
030 Silicon hoses shiny glossy blue
straight reducer 4 to 2 inches
10.00 piece
Requested delivery period from 1 9/06/2018 til l 22/06/2018
040 Silicon hoses shiny glossy blue
straight reducer 4 to 2.5 inches
10.00 piece
Request 7000543257 Date: 19/06/2018
actually i want the extract data from 010 to 020 and i wantt to use in loop can you guide me
how to extract data between this string and used in loop
like between
from 010 to 020
and i want use in loop …data automatic extract from like
1.data 010 to 020
2.data 020 to 030
3.data 020 to 040
4.data 040 t0 end
Hi. I am using the Between,zip. Can someone help me elaborate on it a bit.
I need to extract text from the following text file. The first bit of text i need to get is between the first instance of “Email” and first instance of “Buyers Name”.
I have this working with your sequence. But what do I do if i need to split between second instance of “Email” and Second Instance of “Buyers Name”??
Also, I have this string as one of my outputs “hi@gmail.com John Smith”. I need to split this into two but keep the name and not the email. I am using this buyersname(1).Split({“@”},stringsplitoptions.None) but just returning the email.