#364 Add some character constants to the string class

v4.2.0
closed
Rick McGuire
None
complete
5
2014-04-15
2009-07-18
Rick McGuire
No

For a a lot of characters, it would be nice to be able to refer to the characters using a symbolic constant rather than hard-coding a value as a hex string. It would be nice if the string class had constants defined for some of the common characters (particularly the non-printable ones). That is

.sttring~nl -> '0a'x
.string~cr -> '0d'x
.string~tab -> '09'x
.string~null -> '00'x

etc.

Discussion

  • Jon Wolfers
    Jon Wolfers
    2009-09-06

    Hi RIck,

    might it not be more consistent to include these in the environment directory along with .endofline ?

    just a thought,

    Jon

     
  • Hi,
    got a patch, we like to know if I should commit it :-)

    Added to CoreClasses:
    +
    +.String~!define_class_method("NL", .methods~string_cls_nl)
    +.String~!define_class_method("CR", .methods~string_cls_cr)
    +.String~!define_class_method("TAB", .methods~string_cls_tab)
    +.String~!define_class_method("NULL", .methods~string_cls_null)
    +/============================================================================/
    +/ Additional S T R I N G methods /
    +/============================================================================/
    +::METHOD string_cls_nl
    + return "0a"x
    +::METHOD string_cls_cr
    + return "0d"x
    +::METHOD string_cls_tab
    + return "09"x
    +::METHOD string_cls_null
    + return "00"x

     
  • Rick McGuire
    Rick McGuire
    2013-11-20

    • Pending work items: --> none
    • Milestone: None --> v4.2.0
     
  • Rick McGuire
    Rick McGuire
    2013-11-22

    • status: open --> accepted
    • assigned_to: Rick McGuire
    • Pending work items: none --> code+doc+test
     
  • Rick McGuire
    Rick McGuire
    2013-11-23

    • Pending work items: code+doc+test --> doc+test
     
  • Rick McGuire
    Rick McGuire
    2013-11-23

    Code committed [r9554]

     

    Related

    Commit: [r9554]

  • Rick McGuire
    Rick McGuire
    2013-12-03

    • Pending work items: doc+test --> tests
     
  • Rick McGuire
    Rick McGuire
    2013-12-03

    docs committed [r9608]

     

    Related

    Commit: [r9608]

  • Rick McGuire
    Rick McGuire
    2013-12-03

    • status: accepted --> pending
    • Pending work items: tests --> complete
     
  • Rick McGuire
    Rick McGuire
    2014-04-15

    • status: pending --> closed
     
  • Rick McGuire
    Rick McGuire
    2014-04-15

     


Anonymous


Cancel   Add attachments