Generic to_string() and to_array() functions

Bug #54226 reported by wouter bolsterlee
2
Affects Status Importance Assigned to Milestone
Anewt
Fix Released
Wishlist
wouter bolsterlee

Bug Description

I would like two generic type conversion functions: to_string() and to_array(). The logic implemented by these two functions should somewhat resemble the Page::append_to() method, ie. recursively "collapse" values until they have the correct type.

Tags: core
Revision history for this message
wouter bolsterlee (wbolster) wrote :

Btw, any thoughts on a decent way to convert array into strings? perhaps array_format() for associative array and implode_newlines for numeric arrays?

Changed in anewt:
importance: Undecided → Wishlist
Revision history for this message
wouter bolsterlee (wbolster) wrote :

Working on to_string, to_array is not so useful I think.

Changed in anewt:
assignee: nobody → uws
status: New → In Progress
Revision history for this message
wouter bolsterlee (wbolster) wrote :

  581 Wouter Bolsterlee 2007-08-07
      Implemented generic to_string() function

      The new global to_string() function renders various objects
      to a string. This function creates a string from various
      types of objects by applying various conversion methods.
      Supported data types:

      - Simple values: strings, integers, floats, boolean
        (0 or 1).
      - Any object implementing a render(), to_xhtml(),
        to_string() or toString() method.
      - Numerical arrays containing any of the supported types are
        recursively converted to string values, separated by
        newlines.

      An error is thrown if the passed object cannot be handled.

      Some test cases are included.

      This fixes bug #54226.

Changed in anewt:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.