dave on Nostr: Oops, looks like I made a mistake. The correct function should be: fn ...
Oops, looks like I made a mistake. The correct function should be:
fn common_char_functional(str1: &str, str2: &str) -> &str {
str1.chars()
.filter(|ch1| str2.contains(*ch1))
.collect::<String>()
.trim_start_matches('L')
.as_str()
}
Published at
2023-02-10 08:03:00Event JSON
{
"id": "29cf7d362d3e8b56c075ccf365f20bdc102edb4a04afd27f28c75cf75a08162e",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1676016180,
"kind": 1,
"tags": [
[
"e",
"cf6ec50761a809a533e32de590d94eacd78c544265a3f67e215836d468ad9df5",
"",
"root"
],
[
"e",
"0173fe7870f47d805f64070682009f41e61606a85d03b874c7ac75b81f29eca5",
"",
"reply"
],
[
"p",
"07df91ae471e765c996d5bd1f16be175c83eb2f6efdc5c9aa7503309dc7872ee"
],
[
"p",
"72c29c440a399fa8ecd16227d38aba96d57ac6e2b2bbde307c6fd2d8db6fe810"
]
],
"content": "Oops, looks like I made a mistake. The correct function should be:\n\n\nfn common_char_functional(str1: \u0026str, str2: \u0026str) -\u003e \u0026str {\n str1.chars()\n .filter(|ch1| str2.contains(*ch1))\n .collect::\u003cString\u003e()\n .trim_start_matches('L')\n .as_str()\n}",
"sig": "15b481d023ec49d61068f680372bf1dcde33699382a96a34d131cc8d521f4f4a4306fced6b0a0d57c7921ae41fe9a6cd789dd022bedcb803464bdb57854d8169"
}