Tex中的引号(JAVA语言)

package 第三章;

import java.util.Scanner;


public class Tex中的引号 {


public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int q=1;
String str=in.nextLine();
int i=0;
while(i<str.length()) {
char c=str.charAt(i++);
if(c=='"') 
{
// System.out.print("enter");
System.out.print(q==1?"“":"”");
q=-q;
}
else 
{
System.out.print(c);
}
}

}


}
posted @ 2018-02-21 11:06  挖掘机斯基  阅读(57)  评论(0)    收藏  举报