Questions tagged as 'string'

1
answer

Difference between Integer.valueOf (String) and Integer.parseInt (String)

I need to convert a String to int , and I came across these two options, which have an equal result. Is there any difference between them? Is there a rule / convention that says which to use or is indifferent?
asked by 09.12.2014 / 12:09
8
answers

Printing a String until a space is found

I get a String through an input and I insert it into the database. When I list, I want only the first name of the person, that is, until the first space is found. Is there a function that does this?     
asked by 11.11.2015 / 20:04
1
answer

What is the purpose of Array and String Dereferencing implemented in PHP 5.5?

In the PHP manual, we can see the New Features functionality of Array and String literal Dereferencing . Example: echo 'string'[2]; // r echo ['stack', 'overflow'][1]; //overflow Thinking about whether to get a index from a strin...
asked by 03.07.2014 / 18:09
6
answers

Code refactoring to convert GPS coordinates in DMS format into an array

You can enter the GPS coordinates in two ways, Decimal Degrees or Degrees, Minutes, Seconds : ┌─────────────────────────────────┬─────────────────────┐ │ DMS (Degrees, Minutes, Seconds) │ DD (Decimal Degree) │ ┌────────...
asked by 10.01.2014 / 17:09
4
answers

rtrim () to remove "br" also removes the letter "r" if it is the last letter in the string

If a string ends with an HTML tag, for example <br> or <hr> , when making use of the PHP function # to clean the tag, in cases where the letter immediately before is an "r", it is removed together with the HTML tag: E...
asked by 03.07.2014 / 06:32
3
answers

Comparison between a numeric and an alphanumeric string

The following operation returns true: var_dump("1" == "1e0"); //1 == 1 -> true But if I add an "e" at the end of the second string, it returns false: var_dump("1" == "1e0e"); //1 == 1 -> false??? If you do the following, return 2...
asked by 26.08.2014 / 19:58
3
answers

How to use more than one separator character in the split () method?

I'd like to break String into several substrings, for this I'm using the split() method. It turns out, I'm not sure what characters can be in the variable I'll use. Exemplifying: String words[] = line.split(" "); This code...
asked by 26.11.2014 / 18:09
3
answers

Catch only the values before the "=" character using regular expression?

I have a file containing the following content: Maringa=123123 Marialva=789789 Mandaguacu=123456 Cidadex=A341a2 How do I get only the characters before = , using regular expression? I tried it like this: .*= But the String c...
asked by 13.12.2013 / 17:46
4
answers

How to select a text snippet in a String?

I'm creating a text file and using some delimiters ( <# and #> ) I need to select what's inside the <# texto.delimitado #> delimiter. Using the split() JavaScript function. What would be the best regular...
asked by 30.12.2013 / 04:43
2
answers

What is the difference between varchar and nvarchar?

What's the difference between using data types varchar and nvarchar ? nvarchar exists in every SQL database? Is there any significant difference in performance between the two? Is there a criteria for using them? A...
asked by 21.06.2017 / 15:13