Skip to main content
general ovehaulming , grammar improved, syntax improved , better formatting and prettier post
Source Link

Find a substring within a string in c#C#

I have a list of strings ofwith the below format :

full1

full1inc1

full1inc2

full1inc3

full2

full2inc1

full2inc2

full3

.

.

full100inc100

  • full1
  • full1inc1
  • full1inc2
  • full1inc3
  • full2
  • full2inc1
  • full2inc2
  • full3
  • ...
  • ....
  • full100inc100

Basically, the integer value after fullthe "full" can be any number and the "inc" may or may not be there.

I have to pick an arbitrary string from this list ,say let's say the "full32" or the "full32inc1" and isolate the substringsubstring "full" along with the number that follows and put it in another string. 

How am i suppose tocould I do this  ? Should I use regexRegex or string matchingString Matching ??

Find a substring within a string in c#

I have a list of strings of the format :

full1

full1inc1

full1inc2

full1inc3

full2

full2inc1

full2inc2

full3

.

.

full100inc100

Basically, the integer value after full can be any number and "inc" may or may not be there.

I have to pick an arbitrary string from this list ,say "full32" or "full32inc1" and isolate the substring "full" along with the number that follows and put it in another string. How am i suppose to do this  ? use regex or string matching ??

Find a substring within a string in C#

I have a list of strings with the below format :

  • full1
  • full1inc1
  • full1inc2
  • full1inc3
  • full2
  • full2inc1
  • full2inc2
  • full3
  • ...
  • ....
  • full100inc100

Basically, the integer value after the "full" can be any number and the "inc" may or may not be there.

I have to pick an arbitrary string from this list , let's say the "full32" or the "full32inc1" and isolate the substring "full" along with the number that follows and put it in another string. 

How could I do this? Should I use Regex or String Matching ?

Source Link
Aman Mehrotra
  • 413
  • 4
  • 8
  • 15

Find a substring within a string in c#

I have a list of strings of the format :

full1

full1inc1

full1inc2

full1inc3

full2

full2inc1

full2inc2

full3

.

.

full100inc100

Basically, the integer value after full can be any number and "inc" may or may not be there.

I have to pick an arbitrary string from this list ,say "full32" or "full32inc1" and isolate the substring "full" along with the number that follows and put it in another string. How am i suppose to do this ? use regex or string matching ??