Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    @user1810100 mentioned essentially that almost exactly 5 years to the day before you posted this... Commented Mar 12, 2019 at 18:50
  • 1
    Adding an if s.find("ZZZ") > s.find("AAA"): to it, avoids issues if 'ZZZ` isn't in the string, which would return '1234uuijjk' Commented Nov 14, 2020 at 20:42
  • @tzot's answer (stackoverflow.com/a/4917004/358532) with partition instead of split seems more robust (depending on your needs), as it returns an empty string if one of the substrings isn't found. Commented Sep 16, 2021 at 15:33