From ec42be940281d29e8b629882fdcd8e650609c0a6 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Tue, 16 May 2017 14:04:17 +0000 Subject: [PATCH] added method to remove html tags git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-util-library@148716 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 8 +++++++- pom.xml | 2 +- .../social_networking/socialutillibrary/Utils.java | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 6a8eaba..fe4ce8a 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,7 +1,13 @@ + + Added method to remove html tags from a text (useful for #247) + + - Bug #8063, Share Updates links are truncated in some cases + Bug #8063, Share Updates links are truncated in some cases + diff --git a/pom.xml b/pom.xml index 55a137d..bac13eb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.socialnetworking social-util-library - 1.1.0-SNAPSHOT + 1.2.0-SNAPSHOT social-util-library The social-util-library contains utility functions that can be used by the social-networking portlets. diff --git a/src/main/java/org/gcube/social_networking/socialutillibrary/Utils.java b/src/main/java/org/gcube/social_networking/socialutillibrary/Utils.java index e8fe217..34d5212 100644 --- a/src/main/java/org/gcube/social_networking/socialutillibrary/Utils.java +++ b/src/main/java/org/gcube/social_networking/socialutillibrary/Utils.java @@ -352,4 +352,18 @@ public class Utils { description = ((description.length() > 256) ? description.substring(0, 256)+"..." : description); return description; } + + /** + * Remove HTML tags from text by using the following '\\<[^>]*>"' + * @param text + * @return a String without html tags + */ + public static String removeHTMLFromText(String text){ + + if(text == null) + return null; + else + return text.replaceAll("\\<[^>]*>",""); + + } }