Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列が有効な ObjectId であるかどうかを確認する簡単な方法はありますか? 無効な文字列から ObjectId を作成しようとすると、例外がスローされます。try-catch ブロックを回避する方法はありますか?
考えられる方法の 1 つは、この正規表現をチェックすること^[0-9a-b]{48}$ です。もっとエレガントなものはありますか?
^[0-9a-b]{48}$
方法がありますObjectId.isValid(String s):docs
ObjectId.isValid(String s)
I have Example Class:
class Example { private: int testValue1; int testValue2; int testValue3; public: Example(int pVal1, int pVal2, int pVal3); Example(const Example); c