Questions tagged [value-of]

138 questions
2
votes
1 answer

Performance of BigDecimal.valueOf( double d )

I have a piece of code that needs to repetitively calculate the following... double consumption = minConsumption + ( Math.random() * ( ( maxConsumption - minConsumption ) + 1 ) ); currentReading = currentReading.add(…
Mike Q
  • 22,839
  • 20
  • 87
  • 129
2
votes
1 answer

Select value of xml document with namespace

I have the following XML snippet 123321 And i want to select the value of with XSL template, but not able to get it by using
evilsoldier
  • 161
  • 12
2
votes
1 answer

XSLT: value-of returns repeated element value

I am attempting to extract element values associated with attributes of specific values: Example: //Profile/Topic/Attrib[@name='description'] The value returned repeats in the Output XML for each Profile. The target entity is the "Profile" which…
GLarose
  • 171
  • 1
  • 9
2
votes
1 answer

Is it possible to force XSLT transformation to fail if an element does not exist?

We are using XSLT stylesheets to extract data from a large XML file and write it to a CSV file. The code to write out the value to CSV typically looks like this: ...
Hoppy
  • 720
  • 2
  • 12
  • 24
2
votes
1 answer

Significance of valueOf() in javascript

I have noticed the snippet_1 in the implementation of one of the Node API's. Snippet_2 has been written by me. I don't feel much difference between them. Is there really any significance of using valueOf() function. And also, we can notice a…
Prem
  • 5,685
  • 15
  • 52
  • 95
2
votes
2 answers

String.valueOf(someVar) vs ("" + someVar)

I want to know the difference in two approaches. There are some old codes on which I'm working now, where they are setting primitive values to a String value by concatenating with an empty String "". obj.setSomeString("" + primitiveVariable); But…
Arun Sudhakaran
  • 2,167
  • 4
  • 27
  • 52
2
votes
1 answer

Racket - make-closure and apply-closure

So I'm fairly inexperienced with Racket but am writing an interpreter. I've been unable to find insight as to what exactly a closure is, or how "apply-closure" or "make-closure" would be defined/explained. I'm writing just a value-of interpreter…
A_J
  • 75
  • 1
  • 3
2
votes
3 answers

Difference between String.valueOf(int i) and printing only i

See the below code snippet: int count = 0; String query = "getQuery"; String query1 = "getQuery"; final String PARAMETER = "param"; query += "&" + PARAMETER + "=" + String.valueOf(count); query1 += "&" + PARAMETER + "=" +…
MonsterJava
  • 423
  • 7
  • 23
2
votes
2 answers

How do I only retrieve numbers in an EditText instead of the whole String?

Double value = Double.valueOf(temp.getText().toString()); Let's say editText temp is 32 Celsius. I only want to get 32 instead of "32 Celsius" so how would I be able to do this? Is this possible? I'm a newbie with Android Studio.
Marcella Ruiz
  • 323
  • 1
  • 3
  • 15
2
votes
1 answer

Counting nodes with certain attribute values in XSLT

Suppose I have some XML like this:
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
2
votes
3 answers

Clarification regarding Integer comparison?

class Demo{ public static void main(String[] args) { Integer i = Integer.valueOf(127); Integer j = Integer.valueOf(127); System.out.println(i==j); Integer k = Integer.valueOf(128); Integer l =…
2
votes
3 answers

Java autoboxing ValueOf(String)

What do you think about the following line of code?: String s= "10.0"; float f = Float.valueOf(s).floatValue();//1 Is it necessary? Why would it be better using such a syntax rather than using: float f = Float.valueOf(s);//2 It still gives the…
Rollerball
  • 12,618
  • 23
  • 92
  • 161
2
votes
5 answers

java String.valueOf issue

I wrote this code: byte[] test = {-51}; byte[] test2 = {-51}; byte[] test3 = {-51}; System.out.println(String.valueOf(test)); System.out.println(String.valueOf(test2)); System.out.println(String.valueOf(test3)); And i've got a different…
1
vote
1 answer

variable name with value of int i

i try made something like this: for (int i=0; i<8; i++) { UIButton *btn_i = [[UIButton alloc] initWithFrame:CGRectMake(0 * numberRowsOfMenu, 0 * heightOfRow, btnWidth, btnHeight)]; } where UIButton *btn_i is btn_ + value of i. it is possible in…
Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79
1
vote
1 answer

When the method valueOf may be absent?

I have this code. And I don't understand how it works. let obj = { valueOf: function () { return {}; }, toString: function () { return 222; } }; console.log(Number(obj)); //222 According to this source, the…
Ivan
  • 478
  • 2
  • 13
1 2
3
9 10