From 5a80fad2c7385c0f092b054194bb2e3aa5e3a732 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 30 Sep 2019 16:40:47 +0900 Subject: [PATCH] Update string.utils.php --- helper/string.utils.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/helper/string.utils.php b/helper/string.utils.php index 789d94d..393dedc 100644 --- a/helper/string.utils.php +++ b/helper/string.utils.php @@ -221,13 +221,17 @@ if(!check_function_exists("remove_utf8_bom")) { } if(!check_function_exists("get_tokenized_text")) { - function get_tokenized_text($text, $delimiters=array(",", " ", "|", "-", "+","\t","\r\n","\n")) { - return array_filter(multi_explode($delimiters, $text)); + function get_tokenized_text($text, $delimiters=array()) { + if(count($delimiters) > 0) { + return array_filter(multi_explode($delimiters, $text)); + } else { + return preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY); + } } } if(!check_function_exists("get_highlighted_html_by_words")) { - function get_highlighted_html_by_word($word, $text, $delimiters=array(",", " ", "|", "-", "+","\t","\r\n","\n")) { + function get_highlighted_html_by_word($word, $text, $delimiters=array()) { $html = $text; $words = get_tokenized_text($word, $delimiters);