From 9aa86b2fe66a9a5e53d264c84dcb8a83c27eed4f Mon Sep 17 00:00:00 2001 From: eiffel-org Date: Fri, 19 Mar 2021 14:23:48 +0000 Subject: [PATCH] Added a section for the reverse conversion. Updated wikipage Getting a STRING from a NUMERIC object. (Signed-off-by:alexk). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2322 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../Getting-a-STRING-from-a-NUMERIC-object.wiki | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/documentation/20.11/eiffel/Tutorials/Mini-HowTo/Getting-a-STRING-from-a-NUMERIC-object.wiki b/documentation/20.11/eiffel/Tutorials/Mini-HowTo/Getting-a-STRING-from-a-NUMERIC-object.wiki index 39f91d94..4ca06ea2 100644 --- a/documentation/20.11/eiffel/Tutorials/Mini-HowTo/Getting-a-STRING-from-a-NUMERIC-object.wiki +++ b/documentation/20.11/eiffel/Tutorials/Mini-HowTo/Getting-a-STRING-from-a-NUMERIC-object.wiki @@ -1,10 +1,12 @@ -[[Property:modification_date|Mon, 10 Sep 2018 09:09:25 GMT]] +[[Property:modification_date|Fri, 19 Mar 2021 14:23:47 GMT]] [[Property:publication_date|Mon, 10 Sep 2018 09:09:25 GMT]] [[Property:uuid|B74D374E-895C-4F22-B95F-656BD78ECD03]] [[Property:weight|1000]] [[Property:title|Getting a STRING from a NUMERIC object]] [[Property:link_title|NUMERIC to STRING]] -Every class has the `out` method that can be used to get a text version of the object. For a lot of classes, this method returns internal information that is not really useful for the end user. But for every `NUMERIC` class, the `out` method returns a text representation of the number that the `NUMERIC` object represents. +== NUMERIC to STRING == + +Every class has the out method that can be used to get a text version of the object. For a lot of classes, this method returns internal information that is not really useful for the end user. But for every NUMERIC class, the out method returns a text representation of the number that the NUMERIC object represents. print_integer (a_integer: INTEGER) @@ -14,4 +16,8 @@ Every class has the `out` method that can be used to get a text version of the o end -Note that for more advanced conversion, you can also use a conversion class like `FORMAT_DOUBLE`. \ No newline at end of file +Note that for more advanced conversion, you can also use a conversion class like FORMAT_DOUBLE. + +== STRING to NUMERIC == + +The reverse conversion is available for all standard numeric types (INTEGER_8, INTEGER_16, etc.) using the features to_integer_8, to_integer_16, etc. of class STRING. The string should contain a valid string representation of the corresponding numeric value. This can be checked by calling is_integer_8, is_integer_16, etc. before calling the conversion functions. \ No newline at end of file