import java.io.*;
public class prog1
{
public static void main(String args[]) throws IOException
{
String str; //記錄輸入資料
String pat; //紀錄樣式
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("輸入樣式");
pat=buf.readLine();
System.out.print("輸入字串");
str=buf.readline();
}
}
import java.io.*;
public class prog2
{
public static void main(String args[]) throws IOException
{
String str;
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
// 0123456789012
System.out.print("輸入如(12)3456-7890之電話號碼字串");
str=buf.readLine();
String a=str;
System.out.println("區域碼"+a.substring(1,3));
System.out.print("電話碼"+a.substring(4,8));
System.out.print(a.substring(9,13));
}
}
import java.io.*;
public class prog3
{
public static void main(String args[]) throws IOException
{
String str; //記錄輸入資料
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("輸入字串");
str=buf.readLine()
import java.io.*;
public class prog4
{
public static void main(String args[]) throws IOException
{
String str;
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("輸入字串");
str=buf.readLine();
String a=str;
System.out.print(a.substring(1));
System.out.print(a.substring(0,1));
System.out.print("ay");
}
}
import java.io.*;
public class prog5
{
public static void main(String args[]) throws IOException
{
String str; //記錄輸入資料
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("輸入字串");
str=buf.readLine();
if(str.matches("[A-Z]{2}+[aeiou]{4}+[a-zA-Z_$]{3,}"))
System.out.println("滿足規則");
if(str.matches("![A-Z]{2}+[aeiou]{4}+[a-zA-Z_$]{3,}"))
System.out.println("不滿足規則");
}
}
- Dec 20 Wed 2006 12:00
prog
close
全站熱搜
留言列表
發表留言