10 online now
Customer reviews
Customers using it now
★★★★★
4,8 · 1.263+ average rating
Verified customer
Leave a review
Need help?

Talk to our team on WhatsApp and we will help you move forward.

💬
Minike Tools Banner

Split Text

Split Text

Split long texts into parts by characters, words, or lines.

Gratis ate 10 MB por arquivo100 MB por enviosem anuncio antes do limite
$titulo = 'Cortar Textos'; $descricao = 'Divida textos longos em partes menores por número de caracteres, palavras ou linhas'; $palavrasChave = 'cortar texto, dividir, split, caracteres, palavras'; $texto = ''; $modo = 'caracteres'; $tamanho = 100; $sobreposicao = 0; $resultado = []; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $texto = $_POST['texto'] ?? ''; $modo = $_POST['modo'] ?? 'caracteres'; $tamanho = intval($_POST['tamanho'] ?? 100); $sobreposicao = intval($_POST['sobreposicao'] ?? 0); if (!empty($texto)) { switch ($modo) { case 'caracteres': $resultado = cortarPorCaracteres($texto, $tamanho, $sobreposicao); break; case 'palavras': $resultado = cortarPorPalavras($texto, $tamanho); break; case 'linhas': $resultado = cortarPorLinhas($texto, $tamanho); break; } } } function cortarPorCaracteres($texto, $tamanho, $sobreposicao) { $partes = []; $inicio = 0; $len = mb_strlen($texto, 'UTF-8'); while ($inicio < $len) { $fim = min($inicio + $tamanho, $len); // Tenta cortar em uma palavra completa if ($fim < $len) { $posEspaco = mb_strrpos(mb_substr($texto, $inicio, $fim - $inicio), ' ', 0, 'UTF-8'); if ($posEspaco !== false && $posEspaco > $tamanho / 2) { $fim = $inicio + $posEspaco; } } $parte = mb_substr($texto, $inicio, $fim - $inicio, 'UTF-8'); $partes[] = trim($parte); $inicio = $fim - $sobreposicao; } return $partes; } function cortarPorPalavras($texto, $maxPalavras) { $palavras = preg_split('/\s+/u', trim($texto)); $partes = array_chunk($palavras, $maxPalavras); return array_map(function($chunk) { return implode(' ', $chunk); }, $partes); } function cortarPorLinhas($texto, $maxLinhas) { $linhas = preg_split('/\r?\n/', trim($texto)); $partes = array_chunk($linhas, $maxLinhas); return array_map(function($chunk) { return implode('\n', $chunk); }, $partes); } ?> - Minike Ferramentas

Recommended next step

Keep this result working for you

Minike connects the tool you are using with the product most likely to generate recurring value.

Prices shown for Brazil and US positioning. Current local checkout charges BRL until the international gateway is enabled.
Share this tool
✓ Link copiado!