字符串去掉空白时,空格不去掉。

This commit is contained in:
yuanke 2016-08-26 09:59:00 +08:00
parent ea238cd407
commit 82779c99ea
2 changed files with 3 additions and 3 deletions

View File

@ -1453,7 +1453,7 @@ function description_showwords_ellipsis(id,num){
});
//去掉空格
str = str.replace(/\s/gi,'');
str = str.replace(/[\f\n\r\t\v]/gi,'');
if(str.length > num){
str = str.substring(0,num)+"...";

View File

@ -247,11 +247,11 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
var desc = ""
if(response.data.data.content){
desc = response.data.data.content.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/&nbsp;/g,"");
desc = response.data.data.content.replace(/<[^>]+>/gi,"").replace(/[\f\n\r\t\v]/gi,"").replace(/&nbsp;/gi,"");
}
if(response.data.data.description){
desc = response.data.data.description.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/&nbsp;/g,"");
desc = response.data.data.description.replace(/<[^>]+>/gi,"").replace(/[\f\n\r\t\v]/gi,"").replace(/&nbsp;/gi,"");
}
if(desc.length > 30){