mirror of
https://github.com/twisterarmy/twister-phpbot.git
synced 2025-02-03 18:44:21 +00:00
mb_strrpos instead of loop
This commit is contained in:
parent
9c01a3d59b
commit
3893eff7b4
@ -129,10 +129,7 @@ class TwisterPost
|
|||||||
$text .= ' #' . str_replace(' ', '_', (string)$tag);
|
$text .= ' #' . str_replace(' ', '_', (string)$tag);
|
||||||
}
|
}
|
||||||
$text = mb_substr($text, 0, $maxLen + 1);
|
$text = mb_substr($text, 0, $maxLen + 1);
|
||||||
$pos = $maxLen;
|
$pos = mb_strrpos($text, ' ');
|
||||||
while (mb_substr($text, $pos, 1) !== ' ') {
|
|
||||||
$pos--;
|
|
||||||
}
|
|
||||||
$text = mb_substr($text, 0, $pos);
|
$text = mb_substr($text, 0, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user