You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::net::IpAddr;
fn main() {
if let Ok(IpAddr::V4(_)) = "01.01.01.01".parse() {
println!("parsed!"); // it gets in!
}
}
Usually, we consider IPv4 address containing only non-leading-zero number 0-255 legal, but not those with leading-zero numbers in. Should we change the behavior?
The text was updated successfully, but these errors were encountered:
original problem: https://leetcode-cn.com/problems/validate-ip-address/
while
std::net::IpAddr::parse
successfully parse the address, but the leetcode problem doesn't regard the address as "legal",test DEMO:
Usually, we consider IPv4 address containing only non-leading-zero number 0-255 legal, but not those with leading-zero numbers in. Should we change the behavior?
The text was updated successfully, but these errors were encountered: