-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest.java
More file actions
53 lines (51 loc) · 1.63 KB
/
Test.java
File metadata and controls
53 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.wiceflow.Proxy;
import java.util.Objects;
import java.util.Scanner;
/**
* Created by BF on 2017/10/11.
*/
//public class Test {
// public static void main(String[] args) {
// System.out.println(System.getProperty("user.dir"));
// System.out.println(System.getProperty("java.class.path"));
//
// }
//}
public class Test {
public static void main(String[] args) {
while (true) {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
int length = input.length();
if (length < 2) {
System.out.println("false");
} else {
int first = 0;
int last = length - 1;
boolean isString = true;
for (int j = 0; j < length; j++) {
String str = input.substring(j,j+1);
if (j == first || j == last){
if (!Objects.equals(str,"\"")){
isString = false;
break;
}
continue;
}
if (Objects.equals(str,"\"")){
String st = input.substring(j-1,j);
if (!Objects.equals(st, "\\")) {
isString = false;
break;
}
}
}
if (isString){
System.out.println("true");
}else {
System.out.println("false");
}
}
}
}
}