Questions tagged [tostring]

"toString" or "ToString" is a major formatting method or function used in high level programming languages. It converts an Object to its string representation so that it is suitable for display.

toString() is a function which can be overridden.

toString

The toString() method is widely used to represent objects as human-readable text and practically every class should implement it. Usually it is very simple: generated string contains the object type and lists values of the most important fields. That's why process of writing such methods can easilly be automated. Eclipse, as the best java IDE in the world, should include functionality of automatic toString() method generation to make its users lives even simpler. Implementing it is the aim of this project.

Java represents this as the toString() method where C# represents it as ToString().

2528 questions
0
votes
6 answers

C# Comparing Decimal types as String

I am writing a logging system for our site and it looks at changes to Entities to see if they should be logged. I keep having a problem where the version of the Entity in the database shows decimal numbers (in string format) as "132.0000" and the…
James P. Wright
  • 8,991
  • 23
  • 79
  • 142
0
votes
2 answers

In Flutter i got a DateTime [yyyy-MM-dd 00:00:00.000] how can i transfer that to be [yyyy-MM-dd] only?

here is the code which i already formatted it to be [yyyy-MM-dd] but it also contains 00:00:00 : child: Text( _selectedDate == null ? 'No Date Choosen!' : '${DateFormat('yyyy-MM-dd').format(_selectedDate)}', style:…
Ahmad Mohy
  • 391
  • 2
  • 6
  • 18
0
votes
0 answers

Why is my inheritance not working? The children objects deleted my ToString() method. C#

I have 3 classes, the first one is an Abstract Class called Equipos with a ToString() abstract method, the second one is called Camiones which overrides the ToString() and shows the attributes "marca" and "dominio", the third one is called Gruas and…
le0nicolas
  • 83
  • 10
0
votes
2 answers

inherited overridden toString method does not use the proper attributes

I'm currently trying to understand inheritance better. Therefore I wrote a simple class to handle vectors and then wanted to create a class for 2D vectors that inherits from the Vector class. Here is the code for the Vector class: ''' public…
0
votes
3 answers

Convert function objects to strings/text?

Has anyone converted a function in R into a string or text object? Let's say for a simple square function, I'd want to convert to a text file: sqfxn <- function(x){ # Get square of x # Expect: # > sqfxn(2) # > 4 output <- x^2 …
0
votes
2 answers

How to customize GridViewColumn display for properties of class?

I have a class Article with several properties. I want to know whether it is possible to override the ToString method for the bool and DateTime properties so that for the booleans they print as "Yes/No" and the DateTime as custom text. Idea is that…
SimonH
  • 5
  • 2
0
votes
1 answer

Taking an input,checking if it's an integer and putting it into a String

The program gets an integer from the user and gets a line from user and checks if they are integer and keeps them if they are. I want to get a line from user in a loop that checks if each value is an integer or not,and then put it into a string of…
Elena Asi
  • 39
  • 7
0
votes
1 answer

Objects.deepToString(Object o) method

The class java.util.Objects contains the deepEquals(Object a, Object b) method that can be used to compare objects of any type (including arrays and null references), but doesn't contain a similar deepToString(Object o). This is disappointing. (By…
John McClane
  • 3,498
  • 3
  • 12
  • 33
0
votes
3 answers

Displaying an ArrayList alphabetically

I have a class written that takes a string, counts the occurrences of each letter within the string and then prints the occurrences of each. I want this to be displayed alphabetically, but not sure how to do this. import java.util.ArrayList; //…
Scott Adamson
  • 385
  • 1
  • 3
  • 10
0
votes
0 answers

Lua: Get a table address within Lua without tostring

I am creating a caching system for complex shapes in Lua and I want it to be backwards compatible as a plug and play replacement for the default, non cached system, to increase performance. I've successfully rendered an object with 6.4 million…
Acecool
  • 682
  • 9
  • 12
0
votes
1 answer

How to understand “add(1)(2)(3)=6”?

I am learning curry function in javascript. And a question occurs to me. // how to implement the add function in the below. add(1)(2)(3) = 6; add(1, 2, 3)(4) = 10; add(1)(2)(3)(4)(5) = 15; I've known the implemented code function add() { var…
quan lili
  • 109
  • 6
0
votes
1 answer

Is there a 'strict' mode to disable the automatic 'toString()' calling in Kotlin?

I'm porting some very stringly typed Java API into Kotlin. Lot's of strings have different meanings, and I'm in the process of creating more meaningful types. I've done that before in Java, and I've grown to profoundly hate the automatic…
Frank Lee
  • 2,728
  • 19
  • 30
0
votes
0 answers

How to print bold in Python after a print(df.tostring())

Very frustrating i would like to apply bold to my last column in my df after a df.to_string() Unfortunately i can't do it as i have this error : 'Styler' object has no attribute 'to_string' Any ideas ? def highlight_max(x): return…
0
votes
1 answer

Class 'String' has no instance method 'tostring', Flutter

I am trying to generate a response from my chatbot(using dialogflow) void response(query) async { AuthGoogle authGoogle = await AuthGoogle( fileJson: "Assets/amigo-pyhyyy-e2d1db5e1ee9.json").build(); Dialogflow dialogflow = await…
0
votes
2 answers

Laravel localized date formatting (pattern)

I would like to set Laravel and Carbon so that, based on the current locale selected by the user, dates will be formatted with the correct pattern. I thought it was enough to set LC_TIME on the desired locale and then use the Carbon method…
Albirex
  • 283
  • 1
  • 2
  • 13