我需要从一个字符串中获取子字符串,它将从不同方面输出前 25 个字符。这里的子字符串应该只考虑逗号 (,) 而不是空格。
场景一:
$str = "the, quick, brown, fox";
$res = "the, quick, brown, fox";
场景二:
$str = "the, quick, brown, fox, jumps, over, the, lazy, dog!";
$res = "the, quick, brown, fox, more";
场景 3:
$str = "the quick, brown fox, jumps over, the lazy dog!";
$res = "the quick, brown fox, more";
场景四:
$str = "the quick brown fox, jumps over, the lazy dog!";
$res = "the quick brown fox, more";
请帮忙!谢谢。
非常对不起我的英语!