Harshad Sharma on Nostr: Discovered the joy of parsing lines of semi-structured text using Elixir's "case" and ...
Discovered the joy of parsing lines of semi-structured text using Elixir's "case" and pattern matching 👀 it's been this easy all this while?
case String.split(weird_trick, " ") do
["Step", _ ] -> "Learn more Elixir"
["Step", "3" ] -> "Profit‽"
end
#Elixir #Programming
Published at
2024-04-10 18:50:08Event JSON
{
"id": "0d6c461b7fb81d1ac97402b8be28b1537e7fbc2d8fb2728a0c27332b204bbfdc",
"pubkey": "82d414701e622116a87340f7cfd13d690113ad2383edbb2bcf8856c5c1ff9013",
"created_at": 1712775008,
"kind": 1,
"tags": [
[
"t",
"elixir"
],
[
"t",
"programming"
],
[
"proxy",
"https://mastodon.sharma.io/users/harshad/statuses/112248422951463309",
"activitypub"
]
],
"content": "Discovered the joy of parsing lines of semi-structured text using Elixir's \"case\" and pattern matching 👀 it's been this easy all this while?\n\ncase String.split(weird_trick, \" \") do\n [\"Step\", _ ] -\u003e \"Learn more Elixir\"\n [\"Step\", \"3\" ] -\u003e \"Profit‽\"\nend\n\n#Elixir #Programming",
"sig": "d93be8649c7aacbdcbec9e46748846b3572ef96330d9bff6a95614235a54d6b59db626a3129e62590026fcd24e905c33e1025d82e0fc3acba4353e61d95eb70c"
}