Wie kann ich "\ t" (wie es aussieht) in Java drucken?

7

Ich möchte Backslash t in Java drucken. Aber wenn ich es versuche, nimmt es es tatsächlich als Operator. Doppelter Backslash hat nicht funktioniert. Wie kann ich das tun?

    
jessica 12.02.2011, 16:27
quelle

7 Antworten

15

Entkomme dem umgekehrten Schrägstrich, indem du einen anderen hinzufügst, zum Beispiel

%Vor%

Wenn das nicht funktioniert, ist möglicherweise etwas anderes in Ihrem Code falsch - bitte posten Sie es, wenn Ihnen das nicht weiterhilft.

    
Esko 12.02.2011 16:29
quelle
8

Sie müssen das '\' mit einem anderen '\'

umgehen %Vor%     
KitsuneYMG 12.02.2011 16:29
quelle
3

Der doppelte Backslash funktioniert.

%Vor%

gibt \ t

aus     
Nick Siderakis 12.02.2011 16:31
quelle
1
%Vor%     
Blokoko 11.10.2012 02:02
quelle
1
%Vor%

Wenn Sie auch die Anführungszeichen brauchen:)

    
Keiichi 11.10.2012 07:01
quelle
0

Um eine Registerkarte in Java einzufügen, wird der gleiche Prozess wie c und java

ausgeführt

In C: -
printf("This will display the tab example \t After tab");

In Java: -
System.out.println("This will display the tab example \t After tab");

Gleiches gilt auch für Neue Zeile
System.out.println("This will display the New Line example \n Next Line");

    
SaviNuclear 27.02.2013 06:43
quelle
0
%Vor%

Dies wird gedruckt: \t easy!

    
user4919188 08.10.2016 10:58
quelle

Tags und Links

yii\base\ErrorException
Copied! Copy Stacktrace Search Stackoverflow Search Google Error

PHP Core Warningyii\base\ErrorException

PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib64/php/modules/mongodb.so (/usr/lib64/php/modules/mongodb.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/mongodb.so.so (/usr/lib64/php/modules/mongodb.so.so: cannot open shared object file: No such file or directory))

$_GET = [
    'id' => '410619',
    'url' => 'how-can-i-print-t-as-it-looks-in-java',
];

$_SESSION = [
    '__flash' => [],
];