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();
}
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();
}
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();
}
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())));
}
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();
}
Aggregations