Code of the day:

Code of the day:

function TNameGenerator.StrasseToStrasse(const _Strasse: string): string;
begin
Result := _Strasse;
end;


called as

Strasse := StrasseToStrasse(_Strasse);

("Strasse" means "road" in German)

(I wrote that code myself and there is an overridden version that does something different. But it confused the hell out of my colleague today.)

Comments

  1. Does the overridden version change it to Straße? It's what I expected reading the method name (also, you can use Unicode identifiers in method names, I believe.)

    ReplyDelete
  2. David Millington I don't believe in non-ASCII names for identifiers. It's just too much hassle if there is one tool that doesn't support it.
    As for what it does: There are multiple formats for street identifiers in use in Germany alone, like K255A, K_2225a, K 255 a and they are all used somewhere when generating file names, or writing to database tables or files. (It's a real mess). And then there are of course other country's standards (We convert data from France, Austria, Switzerland, the Netherlands and some others, even Maroque and UAE at one time). I think we have got at least 10 different implementations of that method.

    ReplyDelete
  3. Thomas Mueller " if there is one tool that doesn't support it." Like the DFM text view of the Delphi IDE.

    ReplyDelete
  4. Uwe Raabe Are you saying that View Form as Text doesn't support Unicode?? That doesn't seem right.

    ReplyDelete
  5. David Millington It is true ....
    Create a Event say for OnCanResize and name it "FormCanReßäöüize"
    than try ShowAsText.

    ReplyDelete
  6. David Millington Yes, that is the case, and yes, that doesn't seem right. The DFM is correctly saved as UTF8, but the DFM text view screws it up. Note, that the streaming system doesn't write UTF8 strings - all those characters are quoted. So there must be someone aware of the fact that UTF8 doesn't play nice inside DFMs.

    ReplyDelete
  7. Jacek Laskowski it can be translated as both: Road or street

    ReplyDelete
  8. David Millington "That doesn't seem right."

    Boy have you got a lot to learn. :-) :-(

    ReplyDelete
  9. You know my reply: Is there a QP link please?

    ReplyDelete

Post a Comment