dave on Nostr: fn common_char_functional(str1: &str, str2: &str) -> &str { str1.chars() ...
fn common_char_functional(str1: &str, str2: &str) -> &str {
str1.chars()
.filter(|ch1| str2.contains(*ch1))
.collect::<String>()
.as_str()
}
Published at
2023-02-10 07:52:04Event JSON
{
"id": "ccdcc5333f95167fc8d16f33586de9ae1048ae92bd9e90556943e86bd23bd188",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1676015524,
"kind": 1,
"tags": [
[
"e",
"cf6ec50761a809a533e32de590d94eacd78c544265a3f67e215836d468ad9df5",
"",
"root"
],
[
"e",
"797c688d239bad8e66879e872f34cb8fac3b2179a04c9625efc1bde1e356b951",
"",
"reply"
],
[
"p",
"07df91ae471e765c996d5bd1f16be175c83eb2f6efdc5c9aa7503309dc7872ee"
]
],
"content": "fn common_char_functional(str1: \u0026str, str2: \u0026str) -\u003e \u0026str {\n str1.chars()\n .filter(|ch1| str2.contains(*ch1))\n .collect::\u003cString\u003e()\n .as_str()\n}",
"sig": "0296c721a42bc77310ec3d8f61e0d27d083fd33a31961b5cb337c6847a4a32da79ae15a21a976e6d40b7cfda35094019b6ac9d44f6f9cd5ea5068a5a5a6dc7be"
}