Skip to content

Instantly share code, notes, and snippets.

@grandsilence
Last active September 19, 2019 10:36
Show Gist options
  • Save grandsilence/5e3ce455359e07265f6d5963d4b08f8a to your computer and use it in GitHub Desktop.
Save grandsilence/5e3ce455359e07265f6d5963d4b08f8a to your computer and use it in GitHub Desktop.
// Methods: After, Before
string response = @"hello_world";
string after = response.After("hello");
// after = "_world"
string before = response.Before("world");
// before = "hello_"
// Methods: Substrings (recursive substring)
string response = @"
<html>
<body>
<h1>Title 1</h1>
<h1>Title 2</h1>
...
</body>
</html>
";
string[] allHeadersText = response.Substrings("<h1>", "</h1>");
// allHeadersText will be an array with: Title 1, Title 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment