You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2015/06/27 23:33:06 UTC

Looking for normal to reverse domain name conversion

Hi all,

Do we have in Commons a util method that converts a domain name (
foo.example.com) into its reverse (com.example.foo)?

TY,
GG

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Looking for normal to reverse domain name conversion

Posted by James Carman <ja...@carmanconsulting.com>.
StringUtils.join(ArrayUtils.reverse(domain.split('.')), '.')

On Sat, Jun 27, 2015 at 5:33 PM Gary Gregory <ga...@gmail.com> wrote:

> Hi all,
>
> Do we have in Commons a util method that converts a domain name (
> foo.example.com) into its reverse (com.example.foo)?
>
> TY,
> GG
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

Re: Looking for normal to reverse domain name conversion

Posted by Benedikt Ritter <br...@apache.org>.
Hi Gary,

none that I'm aware of. Would fit into either [net] or [lang] IMHO. For
example: ClassUtils.domainToPackageName(String) ?!

Benedikt

2015-06-27 23:33 GMT+02:00 Gary Gregory <ga...@gmail.com>:

> Hi all,
>
> Do we have in Commons a util method that converts a domain name (
> foo.example.com) into its reverse (com.example.foo)?
>
> TY,
> GG
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter