How to replace tabs with spaces

satya - Thursday, November 10, 2011 10:58:25 AM

javascript replace tabs with spaces

javascript replace tabs with spaces

Search for: javascript replace tabs with spaces

satya - Thursday, November 10, 2011 10:59:50 AM

javascript replace function

javascript replace function

Search for: javascript replace function

satya - Thursday, November 10, 2011 11:18:53 AM

here is an example


function aspire_codeCommand(commandname, subject, body, ci
			, completesubjectline
			, completeBody)
{
	if (body == "")
	{
		ci.newSubject=subject;
		return;
	}
	//body exists
	var newbody = body.replace(/</g,"<");
	var newbody = newbody.replace(/>/g,">");
	var newbody = newbody.replace(/\t/g,"   ");
	var newbody = "<pre><code>\n" + newbody + "\n</code></pre>";
	ci.newSubject=subject;
	ci.newAppendText = newbody;
}

satya - Thursday, November 10, 2011 11:21:30 AM

same code with tabs replaced with 3 spaces


function aspire_codeCommand(commandname, subject, body, ci
         , completesubjectline
         , completeBody)
{
   if (body == "")
   {
      ci.newSubject=subject;
      return;
   }
   //body exists
   var newbody = body.replace(/</g,"<");
   var newbody = newbody.replace(/>/g,">");
   var newbody = newbody.replace(/\t/g,"   ");
   var newbody = "<pre><code>\n" + newbody + "\n</code></pre>";
   ci.newSubject=subject;
   ci.newAppendText = newbody;
}