org.apache.commons.lang3.StringUtils#removeFirst ( )源码实例Demo

下面列出了org.apache.commons.lang3.StringUtils#removeFirst ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 图片解析
 */
protected ShadowSocksDetailsEntity parseImg(String imgURL) throws IOException, NotFoundException {
	String str = StringUtils.removeFirst(imgURL, "data:image/png;base64,");

	Map<DecodeHintType, Object> hints = new LinkedHashMap<>();
	// 解码设置编码方式为:utf-8,
	hints.put(DecodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name());
	//优化精度
	hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
	//复杂模式,开启PURE_BARCODE模式
	hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);

	try (ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decodeBase64(str))) {
		BufferedImage image = ImageIO.read(bis);
		Binarizer binarizer = new HybridBinarizer(new BufferedImageLuminanceSource(image));
		BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
		Result res = new MultiFormatReader().decode(binaryBitmap, hints);
		return parseLink(res.toString());
	}
}
 
源代码2 项目: mylizzie   文件: GtpCommand.java
static String getLineWithoutResponseHeader(List<String> response, int lineIndex) {
    if (lineIndex < 0 || lineIndex >= (response == null ? -1 : response.size())) {
        return "";
    }
    String line = StringUtils.defaultString(response.get(lineIndex));
    if (lineIndex == 0) {
        return StringUtils.removeFirst(line, "^[=?]\\d*\\s*");
    } else {
        return line;
    }
}
 
源代码3 项目: mylizzie   文件: GtpCommand.java
static List<String> removeResponseHeaderInPlace(List<String> response) {
    if (CollectionUtils.isNotEmpty(response)) {
        String beginElement = response.get(0);
        if (beginElement.startsWith("=") || beginElement.startsWith("?")) {
            beginElement = StringUtils.removeFirst(beginElement, "^[=?]\\d*\\s*");
            response.set(0, beginElement);
        }
    }

    return response;
}
 
源代码4 项目: studio   文件: WebDavServiceImpl.java
protected String getUrl(DavResource resource, String baseUrl, String deliveryUrl, String basePath) {
    String relativePath = StringUtils.removeFirst(resource.getPath(), basePath);
    if(resource.isDirectory()) {
        return baseUrl + relativePath;
    } else {
        return (StringUtils.isNotEmpty(deliveryUrl)? deliveryUrl : baseUrl) + relativePath;
    }
}
 
源代码5 项目: studio   文件: WebDavServiceImpl.java
protected String getUrl(DavResource resource, String profileId, WebDavProfile profile) {
    String relativePath = StringUtils.removeFirst(resource.getPath(), URI.create(profile.getBaseUrl()).getPath());
    if(resource.isDirectory()) {
        return relativePath;
    } else {
        return getRemoteAssetUrl(profileId, relativePath);
    }
}
 
源代码6 项目: smockin   文件: GeneralUtils.java
public static String sanitizeMultiUserPath(final UserModeEnum usermode, final String pathInfo, final String ctxPath) {

        return ( UserModeEnum.ACTIVE.equals(usermode) && StringUtils.isNotBlank(ctxPath) )
                    ? StringUtils.removeFirst(pathInfo, ctxPath)
                    : pathInfo;
    }
 
源代码7 项目: vscrawler   文件: RemoveFirst.java
@Override
protected String handle(String input, String second) {
    return StringUtils.removeFirst(input, second);
}
 
 同类方法