当前位置: 首页>>代码示例>>Java>>正文


Java Strings.join方法代码示例

本文整理汇总了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, "");
  }
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:17,代码来源:Names.java

示例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, "");
}
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:34,代码来源:Names.java

示例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, "");
}
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:16,代码来源:Names.java

示例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();
}
 
开发者ID:SalonDesDevs,项目名称:Shenron-Legacy,代码行数:38,代码来源:CommandAddAdmin.java

示例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);
}
 
开发者ID:SalonDesDevs,项目名称:Shenron-Legacy,代码行数:9,代码来源:CommandTextToEmoji.java

示例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, "/");
}
 
开发者ID:jglrxavpok,项目名称:ShadyMod,代码行数:16,代码来源:BatchFileEntry.java

示例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, ", ");
}
 
开发者ID:surgeplay,项目名称:Visage,代码行数:30,代码来源:VisageHandler.java

示例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;
}
 
开发者ID:jberrueta,项目名称:wiremock-extensions,代码行数:9,代码来源:PlaceholderTransformer.java

示例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));
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:4,代码来源:CommandHelper.java

示例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();
}
 
开发者ID:SalonDesDevs,项目名称:Shenron-Legacy,代码行数:43,代码来源:CommandRole.java

示例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();
    }
}
 
开发者ID:SalonDesDevs,项目名称:Shenron-Legacy,代码行数:56,代码来源:CommandFAQ.java

示例12: ScriptInstance

import joptsimple.internal.Strings; //导入方法依赖的package包/类
public ScriptInstance(ICommandSender sender, String[] args) {
	this(VersionUtils.getEntity(sender), Strings.join(args, " "));
}
 
开发者ID:firegodjr,项目名称:Alagaesias-Ancient-Language,代码行数:4,代码来源:ScriptInstance.java

示例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);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:6,代码来源:Path.java

示例14: specToString

import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String specToString( OptionSpec<?> option ) {
    return Strings.join( new ArrayList<>( option.options() ), "/" );
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:4,代码来源:OptionException.java

示例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, " ");
}
 
开发者ID:firegodjr,项目名称:Alagaesias-Ancient-Language,代码行数:10,代码来源:ScriptInstance.java


注:本文中的joptsimple.internal.Strings.join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。