How to use CSS to cut text when finding a specific character?

Asked

Viewed 75 times

0

How to use CSS or webkit to cut text when finding a specific character?

For example... the following text:

"The success of Judge Sergio Moro is so much that a tourism agency of the state of Paraná has created a package that aims to attract customers with Operation Lava Jato routes. According to the column of Mônica Bergamo, the newspaper Folha de S. Paulo, the package takes people to know the places where the investigations take place, in the city of Curitiba. The script lasts five hours and tourists visit the Attorney General’s Office and then the places where Judge Sergio Moro, the 13th Federal Court attends: the Federal University of Paraná, "where he teaches", and the headquarters of the Federal Court."

I’d like to cut when I find the first stitch .. Would look like this:

"The success of Judge Sergio Moro is so much that a tourism agency of the state of Paraná created a package that aims to attract customers with Operation Lava Jato routes."

That’s possible?

  • 1

    It is not a case of CSS.

  • With CSS you can’t do this.

1 answer

1

Face CSS serves only to "give beauty".

In the case of a more refined processing so I think I should use a back language or javascript. most languages (not to say all) have a function called "split" where Voce delimits where you want to break a given string, in case vc would break at that point, the split returns a matrix, then theoretically this section referring to the first point would be in position 0. Following example

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display the array values after the split.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var str = "O sucesso do juiz Sérgio Moro é tanto que uma agência de turismo do estado do Paraná criou um pacote que visa atrair clientes com rotas da Operação Lava Jato. Segundo a coluna de Mônica Bergamo, do jornal Folha de S. Paulo, o pacote leva as pessoas para conhecerem os locais onde se desenrolam as investigações, na cidade de Curitiba. O roteiro dura cinco horas e os turistas visitam a Procuradoria-Geral da República e depois aos locais onde o juiz Sergio Moro, da 13ª Vara Federal frequenta: a Universidade Federal do Paraná, onde leciona, e a sede da Justiça Federal.";

    var res = str.split(".");
    document.getElementById("demo").innerHTML = res[0];
}
</script>

</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.