Most Blog software provides an option to use a sanitized version of the post title as part of permalink url.大多数博客软件提供了一个可以选择使用消毒版本的职衔的一部分,永久的网址。 Thingamablog, a Java based offline blogging software, doesn’t do it. thingamablog ,一个以Java为基础的离线博客软件,不这样做。 So I decided to create one for myself in Java.所以我决定建立一个为自己在Java 。

To see an example of what I am talking about, see the permalink (permanent link) of this post -看到的一个例子,我所说的,看到的永久性(永久链接)这个职位- http://blog.taragana.com/index.php/archive/how-to-sanitize-blog-title-to-use-as-permalink-in-java/ . It contains the title ( How to Sanitize Blog Title, to use as Permalink, in Java ) with ‘-’ as separator, and without spaces, punctuations etc.它包含的标题(如何消毒博客标题,以作为永久使用,在Java ) ' -'作为分隔符,并没有空格,标点等。

Here is what you would do to sanitize any text in Java:这里是你会做消毒的任何文字在Java :
title.replaceAll(”[\W]+”, “-”) title.replaceall ( “ [ \瓦特] + ” , “ -” )

Note: The second argument is the separator to use.注:第二个论点是分离器使用。

That’s it!这样就大功告成了! Isn’t Java simple?是不是Java的简单?