dave on Nostr: fn common_char_functional<'a>(str1: &'a str, str2: &'a str) -> &'a str { str1.chars() ...
fn common_char_functional<'a>(str1: &'a str, str2: &'a str) -> &'a str {
str1.chars()
.filter(|ch1| str2.contains(*ch1))
.collect::<String>()
.trim_start_matches('L')
}
Published at
2023-02-10 08:16:42Event JSON
{
"id": "22a4c61771caa6506cbb0daded3b530cc5b691bee028b90e05e87b49c301459a",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1676017002,
"kind": 1,
"tags": [
[
"e",
"cf6ec50761a809a533e32de590d94eacd78c544265a3f67e215836d468ad9df5",
"",
"root"
],
[
"e",
"5f08056cfdbdb1a2d0277718ca6511958e68e9d2cf4285f96764adce4508da86",
"",
"reply"
],
[
"p",
"07df91ae471e765c996d5bd1f16be175c83eb2f6efdc5c9aa7503309dc7872ee"
],
[
"p",
"72c29c440a399fa8ecd16227d38aba96d57ac6e2b2bbde307c6fd2d8db6fe810"
]
],
"content": "fn common_char_functional\u003c'a\u003e(str1: \u0026'a str, str2: \u0026'a str) -\u003e \u0026'a str {\n str1.chars()\n .filter(|ch1| str2.contains(*ch1))\n .collect::\u003cString\u003e()\n .trim_start_matches('L')\n}",
"sig": "96b5c52346e9cd77cb7b46d03fefcbf600c85311fa237f8e0e690411cba1239a041e602c1aa9245201a0222f47d7c226007fcefd58d003a87f901ad43637979d"
}