Search in sources :

Example 21 with StringBuilder

use of java.lang.StringBuilder in project rivescript-java by aichaos.

the class ExampleMacro method call.

public String call(com.rivescript.RiveScript rs, String[] args) {
    String message = StringUtils.join(args, " ");
    // To get/set user variables for the user, you can use currentUser
    // to find their ID and then use the usual methods.
    String user = rs.currentUser();
    rs.setUservar(user, "java", "This variable was set by Java when you said 'reverse " + message + "'");
    // Reverse their message and return it.
    return new StringBuilder(message).reverse().toString();
}
Also used : StringBuilder(java.lang.StringBuilder) String(java.lang.String)

Example 22 with StringBuilder

use of java.lang.StringBuilder in project platform_frameworks_base by android.

the class VrManagerService method formatSettings.

private static String formatSettings(Collection<String> c) {
    if (c == null || c.isEmpty()) {
        return "";
    }
    StringBuilder b = new StringBuilder();
    boolean start = true;
    for (String s : c) {
        if ("".equals(s)) {
            continue;
        }
        if (!start) {
            b.append(':');
        }
        b.append(s);
        start = false;
    }
    return b.toString();
}
Also used : StringBuilder(java.lang.StringBuilder)

Example 23 with StringBuilder

use of java.lang.StringBuilder in project sugar by satyan.

the class QueryBuilder method generatePlaceholders.

public static String generatePlaceholders(int numberOfArgs) {
    if (numberOfArgs < 1) {
        throw new RuntimeException("The number of arguments must be greater than or equal to 1.");
    }
    StringBuilder stringBuilder = new StringBuilder(numberOfArgs * 2 - 1);
    stringBuilder.append("?");
    for (int i = 1; i < numberOfArgs; i++) {
        stringBuilder.append(",?");
    }
    return stringBuilder.toString();
}
Also used : RuntimeException(java.lang.RuntimeException) StringBuilder(java.lang.StringBuilder)

Example 24 with StringBuilder

use of java.lang.StringBuilder in project robolectric by robolectric.

the class LocalDependencyResolver method getLocalArtifactUrl.

@Override
public URL getLocalArtifactUrl(DependencyJar dependency) {
    StringBuilder filenameBuilder = new StringBuilder();
    filenameBuilder.append(dependency.getArtifactId()).append("-").append(dependency.getVersion());
    if (dependency.getClassifier() != null) {
        filenameBuilder.append("-").append(dependency.getClassifier());
    }
    filenameBuilder.append(".").append(dependency.getType());
    return fileToUrl(validateFile(new File(offlineJarDir, filenameBuilder.toString())));
}
Also used : StringBuilder(java.lang.StringBuilder) File(java.io.File)

Example 25 with StringBuilder

use of java.lang.StringBuilder in project android_frameworks_base by ResurrectionRemix.

the class VrManagerService method formatSettings.

private static String formatSettings(Collection<String> c) {
    if (c == null || c.isEmpty()) {
        return "";
    }
    StringBuilder b = new StringBuilder();
    boolean start = true;
    for (String s : c) {
        if ("".equals(s)) {
            continue;
        }
        if (!start) {
            b.append(':');
        }
        b.append(s);
        start = false;
    }
    return b.toString();
}
Also used : StringBuilder(java.lang.StringBuilder)

Aggregations

StringBuilder (java.lang.StringBuilder)40 Override (java.lang.Override)9 String (java.lang.String)6 IOException (java.io.IOException)5 BufferedReader (java.io.BufferedReader)4 BufferedWriter (java.io.BufferedWriter)2 File (java.io.File)2 NumberFormatException (java.lang.NumberFormatException)2 Object (java.lang.Object)2 ArrayList (java.util.ArrayList)2 Chromosome (PedigreeSim.Chromosome)1 Individual (PedigreeSim.Individual)1 Locus (PedigreeSim.Locus)1 Rational (android.util.Rational)1 Digest (cz1.gbs.core.Digest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileReader (java.io.FileReader)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 RuntimeException (java.lang.RuntimeException)1