tostring

Why does the default Object.toString() return a hex representation of the hashCode?

I'm curious why Object.toString() returns this: return getClass().getName() + "@" + Integer.toHexString(hashCode()); as opposed to this: return getClass().getName() + "@" + hashCode(); What benefits does displaying the hash code as a hex rather than a decimal buy you? ...

How to get floats value without including exponential notation

Hello, In C#, is it possible to perform ToString on a float and get the value without using exponentials? For example, consider the following: float dummy; dummy = 0.000006F; Console.WriteLine(dummy.ToString()); This gives the output 6E-06 However, what I was is 0.000006 The closest I could find was using the "F" qualifier, ...

Automatic .ToString()?

Hi all, I have a method like this: void m1(string str) and have a class like this: public class MyClass { public bool b1 { set; get; } //and other properties } Now why following code does not cause compile error? IClass2 _class2 = new Class2(); MyClass c1 = new MyClass(); _class2.m1("abcdef" + c1); When I debug it, I real...

How can i find the sql query statement of insert() in Zend Framework ?

How can i find the sql query statement in Zend Framework for insert(), like its done for db table select's. $select->__toString(). ...

C# creating a custom NumberFormatInfo to display "Free" when a currency value is $0.00

I need to display a currency in my ASP.NET MVC application but when the currency is 0 I would like it to display "Free" (localized of course!) instead of $0.00. So when I have something like this... Decimal priceFree = 0.00; Decimal priceNotFree = 100.00; priceFree.ToString("C"); priceNotFree.ToString("C"); The output is "$0.00" "$1...

Why does Arrays.toString(values).trim() produce [bracketed text]?

Map<String, String[]> map = request.getParameterMap(); for (Entry<String, String[]> entry : map.entrySet()) { String name = entry.getKey(); String[] values = entry.getValue(); String valuesStr = Arrays.toString(values).trim(); LOGGER.warn(valuesStr); I'm trying to look at a request parameter value using the code above. ...

What is the best standard style for a toString implementation?

We have a lot of objects for which we like to implement a simple toString to output attributes of the object. Some of these attributes may be complex objects themselves. Is there any standard, or simply just a best practice for a style? I'm thinking something like: [SimpleClassName] { prop1:value, prop2:value } In which case a nest...

Im working on this code and expecting a matrix but thats what came up...Matrix@2c78bc3b Matrix@2a8ddc4c

public class Matrix { public static int rows; public static int colms;//columns public static int[][] numbers; public Matrix(int[][] numbers) { numbers = new int[rows][colms]; } public static boolean isSquareMatrix(Matrix m) { //rows = numbers.length; //colms = numbers[0].leng...

Inherited .Net Class ToString Not Overriding

I have created an inherited class "StorageMedium" from a base I called "DataTypes". StorageMedium has two properties, Name() and Capacity(). In the DataTypes object, which all other objects in the class library have been inherited from, I have suppressed the Equals, ReferenceEquals, GetHashCode, ToString and GetType functions so these f...

How do I automatically display all properties of a class and their values in a string?

Imagine a class with many public properties. For some reason, it is impossible to refactor this class into smaller subclasses. I'd like to add a ToString override that returns something along the lines of: Property 1: Value of property 1\n Property 2: Value of property 2\n ... Is there a way to do this? ...

EditText get toString

Hi all, This is my code but i can't fill my string with the value puuted in by the user. I've tried a lot of solutions from other sites but it won't work. Somebody please help me! Thanks already package app.android.Mel import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickLis...