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


Java StringUtils.substringAfterLast方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringUtils.substringAfterLast方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.substringAfterLast方法的具体用法?Java StringUtils.substringAfterLast怎么用?Java StringUtils.substringAfterLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.substringAfterLast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendSlackImageResponse

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private void sendSlackImageResponse(ObjectNode json, String s3Key) {
	try {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode message = mapper.createObjectNode();
		ArrayNode attachments = mapper.createArrayNode();
		ObjectNode attachment = mapper.createObjectNode();

		String emoji = json.get("text").asText();

		if (UrlValidator.getInstance().isValid(emoji)) {
			attachment.put("title_link", emoji);
			emoji = StringUtils.substringAfterLast(emoji, "/");
		}

		String username = json.get("user_name").asText();
		String responseUrl = json.get("response_url").asText();
		String slackChannelId = json.get("channel_id").asText();
		String imageUrl = String.format("https://s3.amazonaws.com/%s/%s", PROPERTIES.getProperty(S3_BUCKET_NAME), s3Key);

		message.put("response_type", "in_channel");
		message.put("channel_id", slackChannelId);
		attachment.put("title", resolveMessage("slackImageResponse", emoji, username));
		attachment.put("fallback", resolveMessage("approximated", emoji));
		attachment.put("image_url", imageUrl);
		attachments.add(attachment);
		message.set("attachments", attachments);

		HttpClient client = HttpClientBuilder.create().build();
		HttpPost slackResponseReq = new HttpPost(responseUrl);
		slackResponseReq.setEntity(new StringEntity(mapper.writeValueAsString(message), ContentType.APPLICATION_JSON));
		HttpResponse slackResponse = client.execute(slackResponseReq);
		int status = slackResponse.getStatusLine().getStatusCode();
		LOG.info("Got {} status from Slack API after sending approximation to response url.", status);
	} catch (UnsupportedOperationException | IOException e) {
		LOG.error("Exception occured when sending Slack response", e);
	}
}
 
开发者ID:villeau,项目名称:pprxmtr,代码行数:38,代码来源:Handler.java

示例2: parse

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Parses the specified schedule into {@link #period execution period}.
 *
 * @param schedule
 *            the specified schedule
 */
private void parse(final String schedule) {
	final int num = Integer.valueOf(StringUtils.substringBetween(schedule, " ", " "));
	final String timeUnit = StringUtils.substringAfterLast(schedule, " ");

	logger.trace("Parsed a cron job [schedule={}]: [num={}, timeUnit={}, description={}], ",
			new Object[] { schedule, num, timeUnit, description });

	if ("hours".equals(timeUnit)) {
		period = num * SIXTY * SIXTY * THOUSAND;
	} else if ("minutes".equals(timeUnit)) {
		period = num * SIXTY * THOUSAND;
	} else if ("seconds".equals(timeUnit)) {
		period = num * THOUSAND;
	}
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:22,代码来源:Cron.java

示例3: getNamespace

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String getNamespace() {
	String fileName = getBlobPath();
	if (fileName.contains("/")) 
		fileName = StringUtils.substringAfterLast(fileName, "/");
	return fileName;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:8,代码来源:TextHit.java

示例4: isSet

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
    * Says if a class must be in debug mode
    * 
    * @param clazz
    *            the class to analyze if debug must be on
    * @return true if the class must be on debug mode, else false
    */
   public static boolean isSet(Class<?> clazz) {
load();

String className = clazz.getName();
String rawClassName = StringUtils.substringAfterLast(className, ".");

if (CLASSES_TO_DEBUG.contains(className)
	|| CLASSES_TO_DEBUG.contains(rawClassName)) {
    return true;
} else {
    return false;
}
   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:21,代码来源:FrameworkDebug.java

示例5: isDuplicatedDirectory

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Java MacOS workaround to detect the duplicated entry at the end of the path
 * 
 * @param file the file to check
 * @return whether the directory at the end of the path is duplicated
 */
private boolean isDuplicatedDirectory(File file) {
	String path = file.getAbsolutePath();
	log.debug("Path: {}", path);
	String lastDir = File.separator+StringUtils.substringAfterLast(path, File.separator);
	log.debug("Last dir: {}", lastDir);
	String pathWithoutLastDir = StringUtils.substringBeforeLast(path, lastDir);
	log.debug("Path without Last dir: {}", pathWithoutLastDir);
	boolean eval = lastDir.length()>1 && pathWithoutLastDir.endsWith(lastDir);
	log.debug("Eval {}", eval);
	return eval;
}
 
开发者ID:KodeMunkie,项目名称:imagetozxspec,代码行数:18,代码来源:FileOutputListener.java

示例6: render

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Component render(String componentId) {
	String fileName = getBlobPath();
	if (fileName.contains("/")) 
		fileName = StringUtils.substringAfterLast(fileName, "/");
	
	return new HighlightableLabel(componentId, fileName, matchRange);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:9,代码来源:FileHit.java

示例7: enumValue

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String enumValue(String input) {
    if(StringUtils.contains(input, '.')) {
        return StringUtils.substringAfterLast(input, ".");
    }
    return input;
}
 
开发者ID:sdadas,项目名称:spring2ts,代码行数:7,代码来源:ServiceRequestProps.java

示例8: convert

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String convert(Tenant tenant, Event event) {
  Group group = event.getGroup();
  if (group == null) {
    return null;
  }
  
  String convertedClassId = null;
  String groupId = null;
  String groupType = group.getType();
  if (isCourseSection(groupType)) {
    groupId = group.getId();
  }
  else {
    groupId = findCourseSectionId(group.getSubOrganizationOf());
  }
  
  if (StringUtils.isBlank(groupId)) {
    return null;
  }
  
  if (StringUtils.startsWith(groupId, "http")) {
    Map<String, String> tenantMetadata = tenant.getMetadata();
    if (tenantMetadata != null && !tenantMetadata.isEmpty()) {
      String tenantClassPrefix = tenantMetadata.get(Vocabulary.TENANT_CLASS_PREFIX);
      if (StringUtils.isNotBlank(tenantClassPrefix)) {
        String classIdAfterPrefix = StringUtils.substringAfter(groupId, tenantClassPrefix);
        if (StringUtils.startsWith(classIdAfterPrefix, "/")) {
          convertedClassId = StringUtils.substringAfter(classIdAfterPrefix, "/");
        }
        else {
          convertedClassId = classIdAfterPrefix;
        }
      }
    }
    else {
      convertedClassId = StringUtils.substringAfterLast(groupId, "/");
    }
  }
  else {
    convertedClassId = groupId;
  }
  
  return convertedClassId;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:46,代码来源:DefaultClassIdConverter.java

示例9: getTableNameFromDmlStatement

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
    * Returns the table name in use type from a DML SQL order.
    * 
    * @param statementType
    *            the statement type (INSERT, ...)
    * @param sql
    *            the sql order
    * 
    * @return the table name in use (the first one in a <code>SELECT</code>
    *         statement) for a DML statement. Returns null if statement is not
    *         DML.
    */
   private String getTableNameFromDmlStatement(String statementType, String sql)
    throws IllegalArgumentException {
// Extract the first order
String statementTypeUpper = statementType.toUpperCase();

String sqlUpper = sql.toUpperCase();

// Extract the table depending on the ordOer
sqlUpper = StringUtils.substringAfter(sqlUpper, statementTypeUpper);
sqlUpper = sqlUpper.trim();

String table = null;

if (statementTypeUpper.equals(INSERT)) {
    sqlUpper = StringUtils.substringAfter(sqlUpper, "INTO ");
    sqlUpper = sqlUpper.trim();
    table = StringUtils.substringBefore(sqlUpper, " ");
} else if (statementTypeUpper.equals(SELECT)
	|| statementTypeUpper.equals(DELETE)) {
    sqlUpper = StringUtils.substringAfter(sqlUpper, "FROM ");
    sqlUpper = sqlUpper.trim();
    // Remove commas in the statement and replace with blanks in case we
    // have
    // a join: "TABLE," ==> "TABLE "
    sqlUpper = sqlUpper.replaceAll(",", " ");
    table = StringUtils.substringBefore(sqlUpper, BLANK);
} else if (statementTypeUpper.equals(UPDATE)) {
    // debug("sqlLocal :" + sqlUpper + ":");
    table = StringUtils.substringBefore(sqlUpper, BLANK);
} else {
    return null; // No table
}

if (table != null) {
    table = table.trim();
}

// Return the part after last dot
if (table.contains(".")) {
    table = StringUtils.substringAfterLast(table, ".");
}

table = table.replace("\'", "");
table = table.replace("\"", "");

return table;
   }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:60,代码来源:FileNameFromBlobBuilder.java

示例10: fromString

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static Submodule fromString(String str) {
	String url = StringUtils.substringBeforeLast(str, SEPARATOR);
	String commitHash = StringUtils.substringAfterLast(str, SEPARATOR);
	return new Submodule(url, commitHash);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:Submodule.java

示例11: ShowQrcodeRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
    * 构造函数
    * @param ticket 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码
    * @param fullDownPath  下载文件路径+文件名
    */
   public ShowQrcodeRequest(String ticket, String fullDownPath) {
	this.ticket = ticket;
	this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
       this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:ShowQrcodeRequest.java

示例12: PerpetualMediaGetRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param mediaId  		媒体文件ID
 * @param fullDownPath  下载文件路径+文件名
 */
public PerpetualMediaGetRequest(String mediaId, String fullDownPath) {
    this.media_id = mediaId;
    this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:PerpetualMediaGetRequest.java

示例13: NewsInnerImgAddRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param fullFilePath  媒体文件路径+文件名
 */
public NewsInnerImgAddRequest(String fullFilePath) {
    this.fileName = StringUtils.substringAfterLast(fullFilePath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullFilePath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:9,代码来源:NewsInnerImgAddRequest.java

示例14: TempMaterialGetRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造器
 * @param mediaId  		媒体文件ID
 * @param fullDownPath  下载文件路径+文件名
 */
public TempMaterialGetRequest(String mediaId, String fullDownPath) {
    this.media_id = mediaId;
    this.fileName = StringUtils.substringAfterLast(fullDownPath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullDownPath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:TempMaterialGetRequest.java

示例15: KfUploadHeadimgRequest

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 构造函数
 * @param fullFilePath  图像文件路径+文件名
 * @param kfAccount     客户帐号
 */
public KfUploadHeadimgRequest(String kfAccount, String fullFilePath) {
    this.kf_account = kfAccount;
    this.fileName = StringUtils.substringAfterLast(fullFilePath, File.separator);
    this.filePath = StringUtils.substringBeforeLast(fullFilePath, File.separator) + File.separator;
}
 
开发者ID:rocye,项目名称:wx-idk,代码行数:11,代码来源:KfUploadHeadimgRequest.java


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