Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.BreakIterator;

import java.util.Locale;

public class Main {
    public static String wordSpace(String source) {
        BreakIterator boundary = BreakIterator.getLineInstance(new Locale("th"));
        boundary.setText(source);
        int start = boundary.first();
        StringBuffer wordbuffer = new StringBuffer("");
        for (int end = boundary.next(); end != BreakIterator.DONE; start = end, end = boundary.next()) {
            wordbuffer.append(source.substring(start, end) + "\u200b");
            //           wordbuffer.append(source.substring(start, end)+"\ufeff");
        }
        return wordbuffer.toString();
    }
}