2,620 questions
3
votes
1
answer
111
views
Why does calling ToString give different results with a Double returned by CDbl and a Double returned by Double.Parse?
Demo code:
System.Console.WriteLine($"CDbl: {(CDbl("234.56"))} {(CDbl("234.56")).GetType} {(CDbl("234.56")).ToString("0.0")}")
...
0
votes
2
answers
108
views
std::fmt::Display implementation does not get padded
I have implemented std::fmt::Display for my struct and I have followed the example from the Display's documentation almost verbatim. However, when I try to pad the string representation, it does not ...
-4
votes
6
answers
215
views
Text.text = int + X?
I'm trying to make my own video game in Unity. I have a series of biomes.
They eventually evolve from bad to good, based on a float converted into an int going from 0 to 100, giving a biome Value of +...
3
votes
3
answers
186
views
For a float number a.bc without underflow and overflow, does a.bc.toString() always =="a.bc"? May it return something like "a.bc00000000000000000001"?
For example, I know 0.12 is not exactly equals to 12/100 in decimal because it needs to be rounded to some value. However, I'm not asking about mathematical problem , but about Javascript spec that ...
3
votes
2
answers
163
views
Flutter toString() seems to be different on debug and release mode
This happened after migrating from Flutter 3.10.5 to 3.24.5.
I have a method on a class that uses a String with the information of what FontWeight to use. Basically, something like this:
final ...
1
vote
1
answer
135
views
Currency culture formatting nl-NL/BE gives uncorrect format
I'm trying to write a currency in the Dutch format:
€1.000,00
meaning:
Euro sign before the amount
Between thousands a dot
Between cents a comma
However when I use CultureInfo "nl-NL" or &...
0
votes
0
answers
53
views
DCoder bitwise solution. As I can't see the test cases, it's difficult to understand what I did wrong
I'm using a website called dcoder.tech to help me test how well I use swift. They show you one test case and the results that your code should output. You write a program that takes input, the website ...
0
votes
0
answers
25
views
comparing toString() in JS with an object gives true [duplicate]
let m = {name : "mastan"};
let n = {name : "mastan"};
m == n
// this gives false because m and n are 2 different objects
JSON.stringify(m) == JSON.stringify(n)
// this gives true ...
3
votes
2
answers
84
views
Getting the wrong value when using the override toString method
I am using an arraylist to hold different shape objects that are a subclass of an abstract superclass. The superclass contains two abstract methods: surface_area and volume respectively. After I add ...
1
vote
1
answer
149
views
How to define a generalisation to_string and to_wstring to avoid code duplication
I have a number of user-defined classes for which I would like to define a to_string function. However, instead of defining this for just std::string, I would like to define this for all the possible ...
1
vote
2
answers
80
views
Why can't I convert this int to String in JavaScript?
So I'm pulling an array of collections from mongoDB and one of the documnets in the collection is a "price" document saved in the DB as a number (int32).
const hotAssets = await Asset.find({ ...
-4
votes
1
answer
65
views
Show full 90 minutes instead of 1:30 [closed]
I have in this code:
label_time.Text = time.ToString("mm");
and it shows only up to 60 minutes and for the remaining 30 minutes starts from 0 and in the end it shows 30. How do I make it so ...
0
votes
1
answer
299
views
When should I use @Override for toString method
I'm studying java and have a question about toString method.
In both case:
//**Case1: **
@Override
public String toString(){
return "Hello world";
}
//**Case2:**
public String toString()...
-3
votes
2
answers
124
views
Is ToString a Static Method? [closed]
I researched extension methods and found out they are static.
I want to know if ToString is a static method?
Because all extension methods are static ... so ToString is a static method too?
-2
votes
2
answers
87
views
Is It possible to in some type of way make a variable in javascript have this ---> var phone number = "(" + Array[1] + Array[2] + Array[3] ")"
this is my code
function createPhoneNumber(numbers)
{
const phonelimit = [10]
for(var i = 0; i < 10; i++)
{
var j = i + 1
if (i == 9)
{
j -= 10
...
0
votes
1
answer
116
views
how to use Arrays.toString directly in java (without Arrays. before it)
Imagine I make an array e.g. int[] a = new int[5], why I cannot use System.out.print(toString(a))? I imported the method by the way, import static java.util.Arrays.toString;
but I get compile error
I'...
3
votes
1
answer
121
views
`std::to_string(INFINITY)` gives seg fault with `g++ -O3`
With g++ version gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~16.04) , when I compile this code like g++ -O3 <file>, and run the executable, then the app gives a seg fault
#include <iostream>...
0
votes
1
answer
125
views
(SpringBoot) can't read resources - already changed the file route - java.lang.NullPointerException
I've been working on integrating a third-party payment gateway into my e-commerce website using SpringBoot. So far, I've followed the steps outlined in online tutorial videos without any issues. ...
2
votes
1
answer
108
views
How can I get IntelliJ to flag any implement of toString()?
We use Lombok, and my architect wants us to always use the Lombok @ToString instead of custom implementation.
I want IntelliJ to flag any toString() implementation as a warning.
How do I do that?
I ...
3
votes
1
answer
162
views
Is it possible to customize only single member output without rewriting complete record's ToString()?
I have record with many members and I want Console.WriteLine(myRecord); to output its values. However one of its members is an array and it will be printed as MyOtherRecordType.Item[]
Is there a an ...
-1
votes
1
answer
104
views
Add Thousand Separator when already using ToString for decimals in c# [duplicate]
I'm doing my program on .net 7 using entity framework.
I need to format my prices like this : 1'234.56
However, they're appearing like this : 1234.56
f.Price.ToString("0.00");
The problem ...
0
votes
1
answer
78
views
toString and valueOf Execution order make me confused [duplicate]
the object f string conversion, but not call the prototype chain toString method
function fn(){}
fn.prototype.toString = function(){
console.log("toString call");
return {};
}
fn....
0
votes
2
answers
228
views
Weird output of JavaScript number.toString method
I'm very new with JavaScript and I was trying to play around doing a function that should do some basic validation of phone numbers. I know for a professional result you should use regex but I'm just ...
1
vote
1
answer
3k
views
slice is not a function [closed]
It gives me an error that slice is not function despite I convert the slice from number to string.
where is the issue ?
var weight = prompt("Enter your Weight");
var height = prompt("...
-4
votes
1
answer
3k
views
What is the difference between .toString("F") and .toString("G") in C# .NET?
According to .NET documentation:
decimal value = 16325.62m;
string specifier;
// Use standard numeric format specifiers.
specifier = "G";
Console.WriteLine("{0}: {1}", specifier, ...
0
votes
1
answer
102
views
What is "n:0" as a number representation?
I printed a value using print(v) and got 7:0.
I can't find any reference to a representation format with a colon-zero at the end. (or with a colon-number)
I am not looking for help to change the way ...
0
votes
1
answer
337
views
Hedera Hashgraph Local Node AccountCreateTransaction Error
I am currently trying to set up my local network by following the steps at https://docs.hedera.com/hedera/sdks-and-apis/sdks/set-up-your-local-network.
I have the code:
const {
Client,
...
0
votes
1
answer
293
views
The argument type 'String' can't be assigned to the parameter type 'num' in Flutter's onChange method
I'm encountering an error in my Flutter app when trying to log the Change object in the onChange method of my Cubit. The error message is as follows:
Error: The argument type 'String' can't be ...
0
votes
1
answer
602
views
Error: The argument type 'String' can't be assigned to the parameter type 'num' in Flutter's onChange method
I'm encountering an error in my Flutter app when trying to log the Change object in the onChange method of my Cubit. The error message is as follows:
''''
Error: The argument type 'String' can't be ...
1
vote
1
answer
520
views
Extracting/filling year and monthly variables in Stata
[]
Above is my data in Stata. The data are xtset using incidentCode and monthlyDate. I need to either interpolate or fill or extract missing values for the variables called, year and month. The ...
-1
votes
1
answer
487
views
Newtonsoft JObject adding newline characters when converting to string [duplicate]
I have a C# program that adds properties to a JObject but when I convert to string, it has \r and \n characters in the output. I'm using a very simple example with only the name and value:
JObject jo ...
0
votes
0
answers
75
views
Format big double with .ToString("f") [duplicate]
I am stucked with this, if you can help me I'd be thankfull
I have a problem converting a big double to string with ToString("f")
In my code, I have the element
double test = Convert....
1
vote
1
answer
2k
views
String of java.nio.file.Path
Can someone explain what I'm doing wrong and/or missing here. I have java.nio.file.Path objects that work fine in my Java application. The only issue is when I try to print them out in logs, and the ...
1
vote
1
answer
1k
views
How to convert a Uni<Response> object into a String?
I am using a Quarkus application which have a dependent client service which pass me the response as a Uni object type
Uni<Response> response = clinetService.someMethod(id);
Now I need to pass ...
1
vote
2
answers
36
views
How can I print out newPassArray[i] as String in few lines in Java by NOT USING Stream?
Dear people who can solve this question, I truly appreciate your kindness!
I am a new programming learner(less than 1 year)
I try to use toSting() but it will print out the empty index too, how can i ...
0
votes
1
answer
313
views
I can't figure out how to get my monkey and dog lists to print as anything but hex codes. I think I need a toString method but I can't get it to work [duplicate]
I'm working on a project for a java class and I'm stuck on this issue. When I run the program and test menu options 4 and 5 I get lists to print but they print as [Dog@42a57993, Dog@75b84c92, Dog@...
0
votes
1
answer
388
views
Issue while Serialized in server project and deserialized in client project in c#
I am hosting API and client will be build by someone else and consume my API.
But while testing I am getting below exception while deserialized in client project.
System.Runtime.Serialization....
0
votes
0
answers
23
views
How to convert a string into a variable in Javascript [duplicate]
My program is when all the three cells have been clicked, all the color of the cell will be appeared in green. In my Javascript program, there is a code line "countx = 1", the idea is to ...
0
votes
2
answers
63
views
Align text in toString
I want to keep the order as it is in this code, but I don't know how to make the value of degree under the value of university
@Override
public String toString() {
return "Education&...
0
votes
1
answer
672
views
Unhandled Runtime Error: Cannot read properties of undefined (reading 'toString') while trying to send a transaction using the Solana wallet-adapter
I'm following an online tutorial on Solana but I'm stuck when I try to make a new transaction using the Phantom wallet - Create React App keeps showing the error message:
Unhandled Runtime Error
...
0
votes
2
answers
90
views
How can I convert an array of numbers to strings?
I can't convert array's numbers into strings. What is wrong with my code?
I also tried: this.userIds.toString().split(',')
collectIds() {
this.array.forEach((e, i) => {
// [8, 8, 8, ...
0
votes
0
answers
189
views
Html string representation of a class in C# .NET
I have a C# .NET 6 class that looks like the following
public class HtmlElement
{
public string Prop1 { get; set; }
public string Prop2 { get; set; }
public string Prop3 { get; set; }
...
-1
votes
2
answers
55
views
not sure how to fix long.tostring failure
` I am doing a problem and we are supposed to write a program that reads a sequence of positive integers. The first zero terminates the input. For each input, N, the program computes the smallest base ...
1
vote
1
answer
250
views
Is it possible to generate formatting members in Visual Studio similar to Rider?
Is there a way to generate formatting members in Visual Studio like in Rider?
When I generate ToString in Visual studio I get this:
Which is useless to me.
when I generate formatting members in Rider ...
0
votes
1
answer
73
views
how to convert datetime to string and make it in a datetimepicker
I created a Search in vb.net button that allows me to display the elements of my table 'book' with as properties (code_ouvrage,id, title book, publishing house and date of edition) now I would like ...
0
votes
1
answer
154
views
Node.js: How to get toString() to print object details
Consider the following code:
class Node {
constructor(data = null, parent = null) {
this.data = data;
this.parent = parent;
this.children = [];
}
appendChild(data) {
this....
0
votes
1
answer
51
views
Expression to string with avoiding to print the closure full path [duplicate]
I have something like this:
private async Task<ProductDo> GetProductsAsync(int tariffId)
{
var filter = new MyFilter
{
Expression = (x, _) => x.Id == tariffId || x....
0
votes
0
answers
81
views
Question about "replace()" and clipboard in Javascript
I am using replace() to replace the bullet points in a text field. It shows up correctly in the console.log but when I use the end function to copy and paste the string into a new text field, it ...
-2
votes
1
answer
184
views
Why does −0 convert to the string "0"?
When dealing with floating-point numbers, −0 is a different number from 0. I am building a timer application in JavaScript and apparently found out the hard way when converting the number of minutes ...
0
votes
3
answers
461
views
in symfony project, in the controller of a Booking entity, I want to check if the user has a role, and then redirect them, what is going error
In this function onAuthenticationSuccess I have the following code to check if the user has a certain role and then i tried to redirect him to the right path, but it seems to be not working, is there ...