1. 程式人生 > >java split 一個或多個空格

java split 一個或多個空格

package com.howso.deeplan.flink.main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * @author Administrator
 *
 */
public class Main {

	public static void main(String[] args) throws IOException {
		/*FileOutputStream out = new FileOutputStream("temp.txt");
		PrintStream p = new PrintStream(out);
		p.println("sadfasdf");
		p.close();
		*/
		String str = "fasdfwe   qwfqwef  4113r1e asdf";
		for (String i : str.split(" +")) {

			System.out.println(i);
		}
	}

}