Reading Substring
-
Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you
-
Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you
You need to look into regular expressions. They are for pattern matching like this. You will need to create a regular expression to match the part of the string you are interested in, and pick out the bit in the middle. Two sites that might help you learn the basics: http://www.regular-expressions.info/dotnet.html[^] http://msdn.microsoft.com/en-us/library/hs600312.aspx[^]
Simon
-
Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you
-
:laugh: Don't worry, most people hate them too. I rarely use them, and always have to go back to the manual to check things when I need to. Post what your trying (in a new question) and maybe some reg-ex superhero can help. http://xkcd.com/208/[^]
Simon
-
:laugh: Don't worry, most people hate them too. I rarely use them, and always have to go back to the manual to check things when I need to. Post what your trying (in a new question) and maybe some reg-ex superhero can help. http://xkcd.com/208/[^]
Simon