Menu

#112 support "stringifying" source code

open
5
2003-07-20
2002-10-14
No

Story:

The user selects a multi-line block of text in the definitions pane.
He then pulls down a menu item labelled "Make selected text into
a String" and the highlighted text is wrapped in quotation marks.
Because Java Strings cannot occur across multiple lines, each
line is wrapped into separate quotation marks (with a "\n" added to
the end of all quoted lines but the last), and the lines are
concatenated. For example, if the user selected the text below:

(this is a (string)
representation of a
list)

It would become:

"(this is a (string)\n" +
" representation of a\n" +
" list)"

This functionality would be useful for writing tests over complex
data structures. Often we want to check that the toString()
representation of a data structure is what we expect. The
expected form is easily retrieved from working code by calling
toString() in the interactions pane, but the resultant String isn't
quoted.

-- Eric

Discussion

  • Peter Centgraf

    Peter Centgraf - 2003-07-20

    Logged In: YES
    user_id=431096

    This is easy enough to implement. I will also need to check for
    all instances of the quote characters and backslash-escape
    them.

     
  • Peter Centgraf

    Peter Centgraf - 2003-07-20
    • assigned_to: nobody --> centgraf
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.