Questions tagged as 'string'

2
answers

Compile string as code

How can I compile a string inside C #? Example: Console.WriteLine(\"Hello World\"); . As if it were a eval of JavaScript? I had a project to load a code into a text file or something else.     
asked by 10.05.2014 / 02:10
2
answers

What is the difference, in practice, between "" and String.Empty?

In .NET you can see the multiple ways to initialize a string with an empty value, commonly known as "double quote". Is there a proper way to do this? And what would be the practical difference between using: var nome = String.Empty;...
asked by 05.09.2016 / 15:33
2
answers

Performance in Java string creation

What is the best way to create Java strings for better performance? Here are two examples of creating strings in Java: Ex. 1: String str = "string"; Ex. 2: String str = new String("string");     
asked by 03.06.2014 / 23:11
5
answers

How to check for similarity between strings?

It is very common to compare strings , which is usually done by comparing equality. However, today I have come up with the need to compare the similarity between two strings , so that I can compare how similar they are. For exam...
asked by 25.03.2014 / 01:28
3
answers

Format double with thousands and decimal

I have the following value: 43239.110000000001 I used this command: txtSomatorio.Text = String.Format( "{0:#.#,##}", somatorio); I achieved this: 43239,11 How do I display it like this? 43.239,11     
asked by 23.12.2014 / 18:45
4
answers

How to pass string by reference?

I passed a string as a parameter. From what I know it is passed by reference, so if I change anything in it within the method, when I leave it the value will continue to change. I did the test below and it did not happen what I expected. Am...
asked by 31.03.2017 / 13:21
2
answers

What is the difference between IsNullOrEmpty and IsNullOrWhiteSpace?

I have here that there is no practical difference between String.Empty and "" , and then it came to me doubt. What's the difference between using String.IsNullOrEmpty(String) and String.IsNullOrWhiteSpace(String) ?...
asked by 20.12.2016 / 22:30
4
answers

How to extract the extension of a file in Javascript?

There are some cases where I need to capture the extension of a file (that is, a string with file address) to be able to validate the extension via Javascript. For example, location : var path = window.location.pathname; // /foo/bar.h...
asked by 28.02.2014 / 22:20
1
answer

What is the difference of Integer.valueOf () when using String or int parameters?

Why are the results of System.out different in the lines below? Integer teste = Integer.valueOf("0422"); Resultado: 422 Integer teste = Integer.valueOf(0422); Resultado: 274 If you pass a int it changes the original value, no...
asked by 17.09.2014 / 16:15
2
answers

What is the equivalent of equalsIgnoreCase () in Kotlin?

What is the equivalent of the String.equalsIgnoreCase() method of Java in Kotlin?     
asked by 20.11.2017 / 05:01