gpt4 book ai didi

org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 21:22:03 27 4
gpt4 key购买 nike

本文整理了Java中org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.trimAtLast()方法的一些代码示例,展示了YangIoUtils.trimAtLast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangIoUtils.trimAtLast()方法的具体详情如下:
包路径:org.onosproject.yang.compiler.utils.io.impl.YangIoUtils
类名称:YangIoUtils
方法名:trimAtLast

YangIoUtils.trimAtLast介绍

[英]Removes extra char from the string.
[中]从字符串中删除额外的字符。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-utils

/**
 * Returns the directory path of the package in canonical form.
 *
 * @param baseCodeGenPath base path where the generated files needs to be
 *                        put
 * @param pathOfJavaPkg   java package of the file being generated
 * @return absolute path of the package in canonical form
 */
public static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg) {
  if (pathOfJavaPkg.charAt(pathOfJavaPkg.length() - 1) == File.separatorChar) {
    pathOfJavaPkg = trimAtLast(pathOfJavaPkg, SLASH);
  }
  String[] strArray = pathOfJavaPkg.split(SLASH);
  if (strArray[0].equals(EMPTY_STRING)) {
    return pathOfJavaPkg;
  } else {
    return baseCodeGenPath + SLASH + pathOfJavaPkg;
  }
}

代码示例来源:origin: org.onosproject/onos-yang-serializers-utils

/**
 * Converts a resource identifier to URI string.
 *
 * @param rid     resource identifier
 * @param context YANG serializer context
 * @return URI
 */
public static String convertRidToUri(ResourceId rid,
                   YangSerializerContext context) {
  if (rid == null) {
    return null;
  }
  StringBuilder uriBuilder = new StringBuilder();
  List<NodeKey> nodeKeyList = rid.nodeKeys();
  String curNameSpace = null;
  for (NodeKey key : nodeKeyList) {
    curNameSpace = addNodeKeyToUri(key, curNameSpace, uriBuilder, context);
  }
  return trimAtLast(uriBuilder.toString(), SLASH);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com