Questions tagged as 'replace'

3
answers

How can I replace a part of a string by itself plus the character "~"?

How can I replace a part of a string with itself plus the "~" character? I am doing this as follows: only when the string has two equal numbers like the 51 that comes shortly after AP and the contained in 17 51 3322 Replace does...
asked by 15.06.2016 / 20:49
2
answers

Using String.Replace the string remains the same

I have the following string : string tt= "{\"Response\":{\"StatusCode\":200,\"StatusMessage\":\"OK\",\"Content\":{\"family\":{\"codigo\":14,\"descricao\":\"Cal\u00e7a\",\"frontoffice\":1,\"posicaofront\":31,\"posicaoprint\":26,\"fundo\":\"#c0...
asked by 17.02.2017 / 14:36
1
answer

Check if String has '+' character

I need to look up a string if it has a + character, like this: teste = teste.replaceAll("+", "e"); but I get this error:    java.util.regex.PatternsSyntaxException: Dangling meta character '+'     
asked by 02.06.2017 / 05:25
1
answer

JS replace all characters equal

I'm trying to use the replace function to turn a letter into 0, however this does not work when I want to test the letter inside a var. var palavra = "abelha"; var letra = 'A'; palavra = palavra.replace(/(letra)/g, '0'); Any solution?     
asked by 17.06.2018 / 22:16
2
answers

Convert utf-8 codes to unicode

Well, I have a JSON where all unicode symbols like this "★" are in this format: "\ u2605" have some way to convert those codes to the symbols when my program NodeJS read the JSON ? Example of how it is: {"name":"\u2605 Bayonet","pri...
asked by 24.08.2017 / 16:47
1
answer

Remove accents - [\\ p {InCombiningDiacriticalMarks}] vs [^ \\ p {ASCII}]

I created a code in Java to remove the accents like the following: private String removerAcentos(String texto) { texto = Normalizer.normalize(texto, Normalizer.Form.NFD); texto = texto.replaceAll("[\p{InCombiningDiacriticalMarks}]",...
asked by 15.11.2016 / 13:48
1
answer

How to encrypt multiple variables inside a file with php?

I'm using php to read a file for a $string , it has some variable words that I need to find and replace with others, ie I need to get these variables, encrypt them with AES and write back where they were, making a replace . The...
asked by 19.10.2016 / 06:16
2
answers

Method that uses a random value as a parameter to change the characters of a string

I have this code that is working perfectly, but I need random values to appear in place of X. I want the returned result to be composed of random letters and that the position of uppercase and lowercase letters be obeyed according to the user in...
asked by 20.10.2017 / 17:36
4
answers

How to avoid value repetitions in this code?

I made the function below that removes accents from a string using values from an object: function remAcentos(p){ var acc = { // ↓ ↓ ↓ ↓ ↓ 'á': 'a', 'â': 'a', 'à': 'a', 'ã': 'a', 'â':...
asked by 18.03.2018 / 00:55
3
answers

Where is the error in replace js?

t = "(10px,10px)" t = t.replace(/-|\d+/g,3,5) I wanted it to result in (3px, 5px) Where is the error?     
asked by 20.02.2018 / 15:41