Android Open Source - TodoList String Utils






From Project

Back to project page TodoList.

License

The source code is released under:

Apache License

If you think the Android project TodoList listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package lyc.simplesqlite.util;
/*ww w. java 2 s  .  c om*/
/**
 * Created by ivan on 14-9-28.
 */
public class StringUtils {

  private StringUtils() {

  }

  public static <T> String join(T[] obj, Callback<T> callback) {
    return join(obj, callback, ", ");
  }

  public static <T> String join(T[] obj, Callback<T> callback, String chr) {
    if (obj.length == 0) {
      return "";
    }
    StringBuilder sb = new StringBuilder();
    int len = obj.length - 1;
    for (int i = 0; ; i++) {
      sb.append(callback.process(obj[i]));
      if (i == len) {
        break;
      }
      sb.append(chr);
    }

    return sb.toString();
  }

  public static String join(Object[] array, String chr) {
    if (array.length == 0) {
      return "";
    }
    StringBuilder sb = new StringBuilder();
    int len = array.length - 1;
    for (int i = 0; ; i++) {
      sb.append(array[i]);
      if (i == len) {
        break;
      }
      sb.append(chr);
    }
    return sb.toString();
  }

  public static interface Callback<T> {

    String process(T t);
  }
}




Java Source Code List

lyc.app.AddActivity.java
lyc.app.App.java
lyc.app.BootReceiver.java
lyc.app.DateUtils.java
lyc.app.MainActivity.java
lyc.app.TodoService.java
lyc.app.adapter.TodoCursorAdapter.java
lyc.app.fragment.FinishedTodoFragment.java
lyc.app.fragment.UnFinishedTodoFragment.java
lyc.app.provider.TodoProvider.java
lyc.simplesqlite.annotation.Column.java
lyc.simplesqlite.annotation.Table.java
lyc.simplesqlite.exception.AnnotationNotFoundException.java
lyc.simplesqlite.util.MetaData.java
lyc.simplesqlite.util.StringUtils.java