javascript - removing the white space at the start of the string -
i want remove white space there in start of string should remove space @ start of string, other spaces should there.
var string=' test';
this want:
function ltrim(str) { if(str == null) homecoming null; homecoming str.replace(/^\s+/g, ''); } also ordinary trim in ie8+:
function trimstr(str) { if(str == null) homecoming null; homecoming str.replace(/^\s+|\s+$/g, ''); } and trimming right side:
function rtrim(str) { if(str == null) homecoming null; homecoming str.replace(/\s+$/g, ''); } javascript jquery
No comments:
Post a Comment