E
E
estry2020-07-29 11:14:16
C++ / C#
estry, 2020-07-29 11:14:16

How to get a C# domain?

Hello. how to get domain from string?
For example,
poddomen.domen.ru
should return
domen.ru

new Uri(" https://poddomen.domen.ru ").Do not suggest host :)
It will return poddomen.domen.ru, but you need the domain domen.ru

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2020-07-29
@estry

from zhezh MS
did not guess to prepare such a trifle ?! (I'll subscribe, all of a sudden someone will enlighten)
By the way, won't you parse?
https://dotnetfiddle.net/kjEJGF
.. and probably 100500 more regular ways.. but I don't like them for some reason ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question