mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 17:44:38 +09:00
#2527 보완: \n 뒤에 공백 남을 수 있는 문제 수정
This commit is contained in:
parent
ec8003003c
commit
2c05d3f0c7
1 changed files with 8 additions and 1 deletions
|
|
@ -680,7 +680,14 @@ function utf8_mbencode($str): string
|
||||||
*/
|
*/
|
||||||
function utf8_normalize_spaces($str, bool $multiline = false): string
|
function utf8_normalize_spaces($str, bool $multiline = false): string
|
||||||
{
|
{
|
||||||
return $multiline ? preg_replace(['/((?!\x0A)[\pZ\pC])+/u', '/\x20(?=\x0A)/u'], [' ', ''], (string)$str) : preg_replace('/[\pZ\pC]+/u', ' ', (string)$str);
|
if ($multiline)
|
||||||
|
{
|
||||||
|
return preg_replace(['/((?!\x0A)[\pZ\pC])+/u', '/\x20*\x0A\x20*/'], [' ', "\n"], (string)$str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return preg_replace('/[\pZ\pC]+/u', ' ', (string)$str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue