All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kalang.helper.StringPlugin Maven / Gradle / Ivy

There is a newer version: 1.11.0
Show newest version
package kalang.helper;

import kalang.annotation.PluginMethod;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.LinkedList;
import java.util.List;

public class StringPlugin {

    @PluginMethod
    public static String[] lines(String str) {
        List list = new LinkedList<>();
        BufferedReader r = new BufferedReader(new StringReader(str));
        try {
            String ln;
            while ((ln = r.readLine()) != null) {
                list.add(ln);
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        return list.toArray(new String[0]);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy