String.Replace not working???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BBM

    #16
    Re: String.Replace not working???

    Add me to the list. Functions exist to return values. Having the language
    allow cmdstr.replace( "X", "Y") is the equivalent of allowing "+=2" as a valid
    line (maybe this works? I haven't tried).

    Thanks again

    "Cor Ligthert [MVP]" wrote:
    [color=blue]
    > BBM,
    >
    > This newsgroup is full of complaints that this is possible expressly by
    > Herfried.
    >
    > Cor
    >
    >
    >[/color]

    Comment

    • Jay B. Harlow [MVP - Outlook]

      #17
      Re: String.Replace not working???

      Cor,
      | The string has so much special ways it is handled in VBNet and is handled
      | that way, that I in my opinion it is worth to handle it special in the IDE
      | in this.
      Special case errors based on a variable being a String, IMHO is too special
      case.

      What happens when the next BBM calls function X on his class & nothing
      happens, as function X on his class returns a new instance rather then
      modifying the target object?

      A more generalized approach (such as an Attribute) that would indicate that
      the return value of a Function is "important" and should be dealt with (such
      as String.Replace) or the return value of a Function is "informatio nal" and
      can be safely ignored (such as StringBuilder.R eplace).

      By "important" I mean that ignoring the return value may result in loss of
      "data", as in the String.Replace case.

      Of course then how do you categorize functions such as DataAdapter.Fil l that
      returns the number of rows effected. The above attribute might need to have
      some form of Level such as None, Warn, Error...

      Where StringBuilder.R eplace would be set to None as it would be safe to
      ignore the return value.

      DataAdapter.Fil l would be set to Warn, as the value can be important, but
      not that important.

      String.Replace would be set to Error, as the value is required & ignoring it
      would result in "data loss".

      I would probably treat no attribute as None.

      Jay



      Hope this helps
      Jay

      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
      news:OtNOAaRmFH A.3572@TK2MSFTN GP09.phx.gbl...
      | Jay,
      |
      | > String is also an object by virtue String is a Reference Type.
      | >
      |
      | I was almost imidiatly making a message when I had sent it.
      |
      | Because I was expecting this answer from you
      |
      | :-)
      |
      | However I decided to wait to make it easier to reply.
      |
      | The string has so much special ways it is handled in VBNet and is handled
      | that way, that I in my opinion it is worth to handle it special in the IDE
      | in this.
      |
      | Only alone the many problems we have seen in this in this newsgroup would
      | justify that. It is not changing the behaviour it is adding a warning.
      |
      | Cor
      |
      |
      |


      Comment

      Working...