本文整理汇总了Java中joptsimple.internal.Strings.join方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.join方法的具体用法?Java Strings.join怎么用?Java Strings.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类joptsimple.internal.Strings
的用法示例。
在下文中一共展示了Strings.join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: smallCamel
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private static String smallCamel(String... name) {
if (name.length == 1 && isBlank(name[0])) {
return "root";
}
List<String> values = new ArrayList<>();
for (int i = 0; i < name.length; i++) {
String s = name[i];
NameFixer format = NameFixer.CAMEL_LOWER;
values.add(buildPart(i, s, format));
}
return Strings.join(values, "");
}
示例2: buildJavaFriendlyName
import joptsimple.internal.Strings; //导入方法依赖的package包/类
/**
* <p>
* buildJavaFriendlyName.
* </p>
*
* @param source a {@link String} object.
* @return a {@link String} object.
*/
private static String buildJavaFriendlyName(final String source, NameFixer format,
int currentIndex) {
final String baseName =
source.replaceAll("\\W+", "_").replaceAll("^_+", "").replaceAll("[^\\w_]", "");
List<String> friendlyNameBits = new ArrayList<>();
int i = currentIndex;
for (String s : baseName.split("_")) {
if (s.isEmpty()) {
continue;
}
String friendlyName = firstOrOthers(format, i, s);
if (isDigits(left(friendlyName, 1))) {
friendlyName = "_" + friendlyName;
}
friendlyNameBits.add(friendlyName);
i++;
}
return Strings.join(friendlyNameBits, "");
}
示例3: typeName
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public static String typeName(String... name) {
if (name.length == 1 && isBlank(name[0])) {
return "Root";
}
List<String> values = new ArrayList<>();
int i = 0;
for (String s : name) {
String value = buildPart(i, s, NameFixer.CAMEL_UPPER);
values.add(value);
i++;
}
return Strings.join(values, "");
}
示例4: handle
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public void handle(MessageCommandCaller caller, List<String> args) throws Exception
{
PermissionManager manager = Shenron.get().getPermissionManager();
DiscordConversation conversation = (DiscordConversation) caller.getConversation();
if (!manager.hasOrFail(caller.getUser(), "owner", caller.getConversation(), "Seul l'owner du bot peut executer cette commande"))
{
return;
}
String message = Strings.join(args, " ");
String name = message.trim();
if (name.startsWith("@"))
{
name = name.substring(1);
}
User user = Shenron.getUserOfGuild(name, caller);
if (user == null)
{
return;
}
String perm = "admin";
String suffix = args.get(1).trim();
if (args.size() == 2)
{
perm += "_" + suffix.toLowerCase();
}
manager.addPermission(user, perm);
conversation.getChannel().sendMessage(mention(user) + " is now admin (" + suffix.toUpperCase() + ")").queue();
}
示例5: handle
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public void handle(MessageCommandCaller caller, List<String> args) throws Exception
{
String message = Strings.join(args, " ");
String result = toEmoji(message);
MessageEditor.edit(caller.getUser(), caller.getConversation(), caller.getMessage(), result, false);
}
示例6: BatchFileEntry
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public BatchFileEntry(FontRenderer font, File file)
{
this.font = font;
this.file = file;
String[] hierarchy = file.getAbsolutePath().split("\\\\");
int maxDepth = 5;
maxDepth = Math.min(maxDepth, hierarchy.length);
String[] pieces = new String[maxDepth];
for(int i = hierarchy.length - maxDepth; i < hierarchy.length; i++ )
{
pieces[i - (hierarchy.length - maxDepth)] = hierarchy[i];
}
this.filepath = Strings.join(pieces, "/");
}
示例7: VisageHandler
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public VisageHandler(VisageDistributor distributor) {
this.distributor = distributor;
List<String> debug = distributor.config.getStringList("debug");
rendererHeader = debug.contains("renderer");
cacheHeader = debug.contains("cache");
reportExceptions = debug.contains("error");
if (rendererHeader || cacheHeader) {
Visage.log.warning("Visage is set to include debugging information in HTTP headers. This should be disabled in production.");
}
if (reportExceptions) {
Visage.log.warning("Visage is set to include exception stack traces in failed requests. This can expose internal system information such as authentication information.");
}
usernames = distributor.config.getBoolean("lookup-names");
minSize = distributor.config.getInt("render.min-size");
defaultSize = distributor.config.getInt("render.default-size");
maxSize = distributor.config.getInt("render.max-size");
maxAttempts = distributor.config.getInt("render.tries");
granularity = distributor.config.getInt("render.size-granularity");
resolverTtlMillis = distributor.config.getDuration("redis.resolver-ttl", TimeUnit.MILLISECONDS);
skinTtlMillis = distributor.config.getDuration("redis.skin-ttl", TimeUnit.MILLISECONDS);
baseUrl = distributor.config.getString("base-url");
List<String> modes = distributor.config.getStringList("modes");
for (String s : modes) {
try {
allowedModes.add(RenderMode.valueOf(s.toUpperCase()));
} catch (IllegalArgumentException ignore) {}
}
allowedModesS = Strings.join(modes, ", ");
}
示例8: lookupQueryParamValue
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String lookupQueryParamValue(String property, Request request) {
QueryParameter queryParameter = request.queryParameter(property);
if (queryParameter.isPresent()) {
System.out.println("Placeholder found in query params");
return Strings.join(queryParameter.values(), ",");
}
return null;
}
示例9: join
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public static String join(String[] args, String separator, int startIndex, int endIndex) {
return Strings.join(Arrays.copyOfRange(args, startIndex, endIndex), com.google.common.base.Strings.nullToEmpty(separator));
}
示例10: handle
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public void handle(MessageCommandCaller caller, List<String> args) throws Exception
{
DiscordConversation conversation = (DiscordConversation) caller.getConversation();
String message = Strings.join(args, " ");
String name = message.trim();
if (name.startsWith("@"))
{
name = name.substring(1);
}
User user = Shenron.getUserOfGuild(name, caller);
if (user == null)
{
return;
}
String role = "a regular user";
PermissionManager manager = Shenron.get().getPermissionManager();
if (manager.hasPermission(user, "owner"))
{
role = "the owner <3";
}
else if (manager.hasPermission(user, "admin"))
{
role = "an admin";
}
else if (manager.hasPermission(user, "admin_sdd"))
{
role = "an admin of 'SDD'";
}
else if (manager.hasPermission(user, "admin_support"))
{
role = "an admin of 'Support Launcher'";
}
conversation.getChannel().sendMessage(KrobotFunctions.mention(user) + " is " + role).queue();
}
示例11: handle
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public void handle(MessageCommandCaller caller, List<String> args) throws Exception
{
DiscordConversation conversation = (DiscordConversation) caller.getConversation();
if (args.size() == 0 || !Shenron.get().getPermissionManager().hasPermission(caller.getUser(), "admin_support"))
{
conversation.getChannel().sendMessage("FAQ : " + link).queue();
return;
}
String message = Strings.join(args, " ");
String name = message.trim();
if (name.startsWith("@"))
{
name = name.substring(1);
}
// TODO: KROBOT: userByName tres lent + effective name
Member member = Shenron.getMemberOfGuild(name, caller);
if (member == null)
{
return;
}
User user = new DiscordUser(member.getUser());
conversation.getChannel().sendMessage(mention(user) + " ! " + Markdown.mdBold("La reponse a ton probleme se trouve dans la " + Markdown.mdUnderline("FAQ")) + "\nCherche bien ;)\n\n" + Markdown.mdBold("==> ") + link).queue();
Guild guild = member.getGuild();
Role moche = guild.getRolesByName("Pabo", true).get(0);
Role hyperMoche = guild.getRolesByName("Hyper Pabo", true).get(0);
Role ultraMoche = guild.getRolesByName("Ultra Pabo", true).get(0);
if (guild.getMembersWithRoles(ultraMoche).contains(member))
{
conversation.getChannel().sendMessage("En plus t'es Ultra Pabo, t'es vraiment le pire des pabo omg").queue();
}
else if (guild.getMembersWithRoles(hyperMoche).contains(member))
{
guild.getController().addRolesToMember(member, ultraMoche).queue();
}
else if (guild.getMembersWithRoles(moche).contains(member))
{
guild.getController().addRolesToMember(member, hyperMoche).queue();
}
else
{
guild.getController().addRolesToMember(member, moche).queue();
}
}
示例12: ScriptInstance
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public ScriptInstance(ICommandSender sender, String[] args) {
this(VersionUtils.getEntity(sender), Strings.join(args, " "));
}
示例13: toString
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
final String joinedPath = Strings.join(getVertices().stream().map(v -> v.getSequenceString()).collect(Collectors.toList()), "->");
return String.format("Path{score=%d, path=%s}", totalScore, joinedPath);
}
示例14: specToString
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String specToString( OptionSpec<?> option ) {
return Strings.join( new ArrayList<>( option.options() ), "/" );
}
示例15: getStringFrom
import joptsimple.internal.Strings; //导入方法依赖的package包/类
/**
* Creates String from an array
*
* @param args
* The array to create from
*/
public static String getStringFrom(String[] args) {
return Strings.join(args, " ");
}