Data de entrada: 14 de mai. de 2022


Assassinos Por Natureza Dublado




Category:Television shows set in Los Angeles Category:Police procedural television series Category:2010s American television series Category:2017 American television series debuts Category:CBS original programming Category:English-language television programsQ: javascript - Replace leading blank space with a specific character I have a text box that can contain data in one or more lines. It can have, for example, the following type of text: Text Text text text Text text Text Text text text Text text I want to remove the first occurrence of any white space, and add a hyphen (-) at the beginning of the text, so that this is what's displayed in the text box: Text-Text text text Text-Text Text-Text text text Text-Text If there's just a single white space, the hyphen will be added, so this is what will happen: Text Text text text Text text Text Text text text Text text I've tried the following: var text = document.getElementById("txtBlankSpace").value; var pattern = new RegExp("^ +","gi"); var replacements = ["-"]; var newText = text.replace(pattern, replacements); document.getElementById("txtBlankSpace").value = newText; This works if there is just one space, but if there is more than one space, it doesn't work. A: replace your "gi" with "g" and you will be fine. "gi" is the global flag. What it means is that you don't care where the match is. It just replaces all the matches. Q: Как поменять ответ от сервера на запрос от клиента? Есть сервер на node.js, к нему подключено браузер в течении 3 мин. После чего происход




Assassinos Por Natureza Dublado

Mais ações