×ðÁú¿­Ê±¹ÙÍøµÇ¼

jsÖл»ÐзûÔõôÌåÏÖ

javascript ÖеĻ»Ðзû¿ÉÒÔʹÓãº\n£¨½ö»»ÐУ©\r\n£¨windows ϵͳÖеĻسµ»»ÐУ©

JSÖеĻ»ÐзûÌåÏÖ

ÔÚJavaScriptÖÐ £¬»»Ðзû¿ÉÒÔʹÓÃ\n£¨»»ÐУ©»ò\r\n£¨»Ø³µ»»ÐУ©ÐòÁÐÌåÏÖ¡£

Ó÷¨£º

\n£ºÔÚËùÓÐƽ̨É϶¼»á±¬·¢Ò»¸öÐÂÐС£

\r\n£ºÍ¨³£ÓÃÓÚWindowsϵͳ £¬ÔÚÆäËûƽ̨ÉÏ¿ÉÄܻᱬ·¢ÒâÏë²»µ½µÄЧ¹û¡£

ʾÀý£º

// ʹÓà \n »»ÐÐ
const text = "ÕâÊÇÒ»ÐÐÎı¾¡£\nÕâÊǵڶþÐС£";

// ʹÓà \r\n »»ÐÐ
const text2 = "ÕâÊÇÒ»ÐÐÎı¾¡£\r\nÕâÊǵڶþÐС£";

console.log(text); // Ò»ÐÐÎı¾¡£
                    // ÕâÊǵڶþÐС£

console.log(text2); // Ò»ÐÐÎı¾¡£
                     // ÕâÊǵڶþÐС£

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

²î±ðµÄƽ̨ºÍä¯ÀÀÆ÷¿ÉÄܶԵ÷ÐзûÓвî±ðµÄÚ¹ÊÍ¡£

½¨ÒéÖ»¹ÜʹÓÃ\n»»ÐÐ £¬ÒÔ°ü¹Ü¿çƽ̨¼æÈÝÐÔ¡£

ÈôÊÇÐèÒªÔÚ×Ö·û´®ÖаüÀ¨ÏÖʵµÄ»Ø³µ»ò»»Ðзû £¬¿ÉÒÔʹÓÃString.prototype.replace()ÒªÁ콫ÆäÌ滻ΪÏìÓ¦µÄתÒåÐòÁС£

ÒÔÉϾÍÊÇjsÖл»ÐзûÔõôÌåÏÖµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ