Se lo ottieni come stringa xxx.xxx.xxx.xxx ti basta valutare solamente le prime due parti.
Le converti in decimale e scrivi la if (anche una sola) di cui ti parlavo

if (b1=10 or (b1=172 and b2=16) or (b1=192 and b2=168)) then ... è privato else ... è pubblico