I'm creating the library about ThaiWordBreak() from Java Code which is attached as the following codes below
B4X:
Public Sub Thaiwordbreak(InputStr As String) As String()
#If Java
Return ThaiwordbreakJava(InputStr)
#End If
End Sub
#If Java
/** @author Nont Banditwong
** TODO To change the template for this generated type comment go to
** Window - Preferences - Java - Code Style - Code Templates
*/
import java.text.BreakIterator;
import java.util.Locale;
//import com.ibm.icu.text.BreakIterator;
//import com.ibm.icu.text.DictionaryBasedBreakIterator;
/**
Private static String[] ThaiWordBreakJava(String source) {
Locale thaiLocale = new Locale(“th”);
BreakIterator boundary = BreakIterator.getWordInstance(thaiLocale);
//BreakIterator boundary = DictionaryBasedBreakIterator.getWordInstance(thaiLocale);
boundary.setText(source);
StringBuffer strout = new StringBuffer();
int start = boundary.first();
for (int end = boundary.next(); end != BreakIterator.DONE; start = end, end = boundary.next()) {
strout.append(source.substring(start, end) + “-”);
}
//System.out.println(strout.toString());
return (strout.toString());
}
#End If