-4

My Text File:

   Users of Yamaha:  (Total of 1 bike issued;  Total of 1 bike in use)
        bike details
        1001  Dinesh , start Fri 1/13 8:55
   Users of Hero:  (Total of 1 bike issued;  Total of 1 bike in use)
        bike details
        1002  Monika, start Fri 1/13 9:55
   Users of Honda:  (Total of 2 bike issued;  Total of 1 bike in use)
        bike details
        1003  Monikadinesh, start Fri 1/13 5:55

Here I want to Extract the line between two strings.Here I want to Append the line into a string. I want to extract the Line between two Users of.

My Extracted String will be like this :

//**The content lie between two users of** 
    (Total of 1 bike issued;  Total of 1 bike in use)Append it in multi array.
                bike details
                1001  Dinesh , start Fri 1/13 8:55

I don't know how to Solve my problem.Help me to solve this.Thanks in advance

monica
  • 91
  • 3
  • 12
  • Possible duplicate of [Get string between two strings in a string](http://stackoverflow.com/questions/17252615/get-string-between-two-strings-in-a-string) – rene Jan 18 '17 at 22:08

1 Answers1

2

take a look at String.Split: https://msdn.microsoft.com/de-de/library/system.string.split(v=vs.110).aspx

It could look like this: string[] split = myString.Split(new string[] { "Users of" }, StringSplitOptions.RemoveEmptyEntries)

than remove everything to the : with this split[0].Substring(split[0].IndexOf(":") + 3)

abc
  • 2,285
  • 5
  • 29
  • 64