Java Code Examples for org.apache.commons.lang3.StringUtils#removeFirst()
The following examples show how to use
org.apache.commons.lang3.StringUtils#removeFirst() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ShadowSocks-Share File: ShadowSocksCrawlerService.java License: Apache License 2.0 | 6 votes |
/** * 图片解析 */ 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()); } }
Example 2
Source Project: mylizzie File: GtpCommand.java License: GNU General Public License v3.0 | 5 votes |
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; } }
Example 3
Source Project: mylizzie File: GtpCommand.java License: GNU General Public License v3.0 | 5 votes |
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; }
Example 4
Source Project: studio File: WebDavServiceImpl.java License: GNU General Public License v3.0 | 5 votes |
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; } }
Example 5
Source Project: studio File: WebDavServiceImpl.java License: GNU General Public License v3.0 | 5 votes |
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); } }
Example 6
Source Project: smockin File: GeneralUtils.java License: Apache License 2.0 | 4 votes |
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; }
Example 7
Source Project: vscrawler File: RemoveFirst.java License: Apache License 2.0 | 4 votes |
@Override protected String handle(String input, String second) { return StringUtils.removeFirst(input, second); }