LKBDE11358: Ein Textstring kann in VBScript nicht mit Anführungszeichen ausgegeben werden


Symptom

Die Bildschirmausgabe hat keine Anführungszeichen um den String

Cause

Wie designed. Man benötigt eine bestimmmte Escape-Sequenz für diese Ausgabe.

Solution

In VBScript werden doppelte Anführungszeichen in Verbindung mit dem &-Operator verwendet, um Strings aneinanderzuhängen (concatenate)
Beispiel:

str = \"Dies ist ein string\"
str = \"Dies ist ein langer\" & \" string\"

Um eine Variable mit dem String in Anführungszeichen zu füllen (z.B. \"Text in Anführungszeichen\"), kann mann die Anführungszeichen verdoppeln:

str = \"\"\"hallo mit Anführungszeichen\"\"\"  return \"hallo\"

oder man verwendet das ASCII-Zeichen Nummer 34 (also \") mit dem &-Operator:

str = chr(34) & \" dies ist auch in Anführungszeichen! \" & chr(34)

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.