Skip to content

Instantly share code, notes, and snippets.

@CDRussell
Created March 31, 2018 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CDRussell/2bb037b4412b94a4b0820f6eaafb35e1 to your computer and use it in GitHub Desktop.
Save CDRussell/2bb037b4412b94a4b0820f6eaafb35e1 to your computer and use it in GitHub Desktop.
private fun parse(url: String): ParseResult {
val result = URL_PARSE_REGEX.find(url)
if(result == null) {
return ParseResult.Error("No match found")
}
val mimeType = result.groupValues[2]
val data = result.groupValues[4]
return ParseResult.ParsedData(data, mimeType)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment