Skip to content

Instantly share code, notes, and snippets.

@CDRussell
Last active March 30, 2018 23:46
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/4fb3b195c466716aa4ad7198496c9f51 to your computer and use it in GitHub Desktop.
Save CDRussell/4fb3b195c466716aa4ad7198496c9f51 to your computer and use it in GitHub Desktop.
private fun parse(url: String): ParsedData {
val result = URL_PARSE_REGEX.find(url)
if(result == null) {
// what do we do here? Throw an exception? Return null?
}
val mimeType = result.groupValues[2]
val data = result.groupValues[4]
return ParsedData(data, mimeType)
}
data class ParsedData(
val data: String,
val mimeType: String
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment