-
-
Save CrowderSoup/9095873 to your computer and use it in GitHub Desktop.
var str = 'This is a test string.'; | |
// Let's replace all spaces with ',' | |
str = str.split(' ').join(','); |
Hie good morning experts i'm here for a solution the Question is in brief
- I'm having 2 jsp pages one is career.jsp in which i'm having a text area user enters any kind of text over here. and i'm having another jsp page named as disp.jsp in which the user entered text in textarea of career.jsp will be displayed over here in this textarea disp.jsp page. hope i'm clear in explanation about the process and now here come my question is that
- The text which is entered by the user in textarea of career.jsp is storing along with the html tags and exactely that text is displaying for me in this disp.jsp page along with the html tags like etc how to solve this Issue help me experts
return string.split(' ').reduce(function(prev,curr,index,arr){
curr = curr.replace(/%/,'%25')
.replace(/"/, '%22')
.replace(/</, '%3C')
.replace(/>/,'%3E')
.replace(/#/,'%23')
.replace(/{/,'%7B');
if(index===arr.length-1) return prev+curr;
else return prev+curr+"%20";
},"");
Used this in a recent project.. while you still use regex.. it sort of ensures that all occurences are properly taken care of.
Awesome! Works perfectly
Very Clever! 👍
Awesome!
how to replace (t) with (B)
in this example: (this is my Text)
the result is:
Bhis is my TexB
or:
this Is my text
try to replace (is)
???
thanks
Thanks
Awesome, it works around the string length limit with the "replace" method.
INSANE!!!! Thank you for it!
👍
Epic!