Java String Split split_fields(String str)

Here you can find the source of split_fields(String str)

Description

splifields

License

Open Source License

Declaration

static String[] split_fields(String str) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    static String[] split_fields(String str) {
        List list = new ArrayList(16);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c == '\t') {
                list.add(sb.toString());
                sb = new StringBuffer();
            } else {
                sb.append(c);/*from  w  w w  . j a v  a2s .com*/
            }
        }
        list.add(sb.toString());
        String[] lines = new String[list.size()];
        Iterator it = list.iterator();
        for (int i = 0; it.hasNext(); i++) {
            lines[i] = (String) it.next();
        }
        return lines;
    }
}

Related

  1. split(String text, String token)
  2. split(String token, String s)
  3. split(String toSplit)
  4. split(String value)
  5. split(String value)
  6. split_str(String input, String split)
  7. splitAndTrim(String str)
  8. splitAndTrim(String str, String splitBy)
  9. splitAndUnEscape(String str)