Browse Source

mb_strrpos instead of loop

master
Denis Ryabov 11 years ago
parent
commit
3893eff7b4
  1. 5
      twisterpost.php

5
twisterpost.php

@ -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…
Cancel
Save