Java Code Examples for org.apache.commons.lang.StringUtils.stripStart()

The following are Jave code examples for showing how to use stripStart() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: dble   File: ItemFuncTrim.java   View Source Code Vote up 6 votes
@Override
public String valStr() {
    String toTrim = args.get(0).valStr();
    if (nullValue = args.get(0).isNullValue())
        return null;
    String remove = null;
    if (getArgCount() == 2) {
        remove = args.get(1).valStr();
        if (nullValue = args.get(1).isNullValue())
            return null;
    }
    String ret = null;
    if (mTrimLeading)
        ret = StringUtils.stripStart(toTrim, remove);
    if (mTrimTrailing)
        ret = StringUtils.stripEnd(toTrim, remove);
    return ret;
}
 
Example 2
Project: Reer   File: XmlTransformer.java   View Source Code Vote up 5 votes
private String stripXmlDeclaration(CharSequence sequence) {
    String str = sequence.toString();
    if (hasXmlDeclaration(str)) {
        str = str.substring(str.indexOf("?>") + 2);
        str = StringUtils.stripStart(str, null);
    }
    return str;
}
 
Example 3
Project: alfresco-repository   File: InviteModeratedSenderTest.java   View Source Code Vote up 5 votes
@SuppressWarnings("rawtypes")
/**
 * Test that the mail action is correctly constructed when sending notifications emails about users requesting access to a specific site
 * @throws Exception
 */
public void testSendModeratedEmail() throws Exception
{                  
    Map<String, String> properties = buildDefaultProperties();
    inviteModeratedSender.sendMail(ENTERPRISE_EMAIL_TEMPLATE_PATH, SendModeratedInviteDelegate.EMAIL_SUBJECT_KEY, properties);

    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_FROM), eq(requesterMail));
    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_TO_MANY), eq(SiteManagerGroup));
    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_SUBJECT), eq(SendModeratedInviteDelegate.EMAIL_SUBJECT_KEY));
    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_SUBJECT_PARAMS), eq(new Object[]{fullSiteName}));
    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_TEMPLATE), eq(emailTemplateNodeRef));

    ArgumentCaptor<Map> modelC = ArgumentCaptor.forClass(Map.class);
    verify(mailAction).setParameterValue(eq(MailActionExecuter.PARAM_TEMPLATE_MODEL), (Serializable)modelC.capture());

    String pendingInvitesLink = StringUtils.stripStart(MessageFormat.format(InviteModeratedSender.SHARE_PENDING_INVITES_LINK, StringUtils.EMPTY, shortSiteName), "/");
    
    // Check the model
    Map model = modelC.getValue();
    assertNotNull(model);
    assertEquals(false, model.isEmpty());
    assertNotNull(model.get("productName"));
    assertEquals(model.get("inviteeName"), requesterFirstName + " " + requesterLastName);
    assertEquals(model.get("siteName"), fullSiteName);
    assertEquals(model.get("sharePendingInvitesLink"), pendingInvitesLink);
 
}
 
Example 4
Project: idea-php-typo3-plugin   File: ObjectManagerTypeProvider.java   View Source Code Vote up 5 votes
public Collection<? extends PhpNamedElement> getBySignature(String expression, Set<String> visited, int depth, Project project) {
    if(expression.startsWith("#K#C")) {
        // PhpStorm9: #K#C\Class\Foo.class
        if(expression.endsWith(".class")) {
            expression = StringUtils.stripStart(expression.substring(4, expression.length() - 6), "\\");
        }
    }

    return PhpIndex.getInstance(project).getClassesByFQN(expression);
}
 
Example 5
Project: idea-php-typo3-plugin   File: GeneralUtilityTypeProvider.java   View Source Code Vote up 5 votes
public Collection<? extends PhpNamedElement> getBySignature(String expression, Set<String> visited, int depth, Project project) {
    if(expression.startsWith("#K#C")) {
        // PhpStorm9: #K#C\Class\Foo.class
        if(expression.endsWith(".class")) {
            expression = StringUtils.stripStart(expression.substring(4, expression.length() - 6), "\\");
        }
    }

    return PhpIndex.getInstance(project).getClassesByFQN(expression);
}
 
Example 6
Project: pai   File: HadoopUtils.java   View Source Code Vote up 4 votes
public static String getHdfsNodePath(String parentNodePath, String nodeName) {
  return (StringUtils.stripEnd(parentNodePath, HDFS_PATH_SEPARATOR) +
      HDFS_PATH_SEPARATOR +
      StringUtils.stripStart(nodeName, HDFS_PATH_SEPARATOR));
}
 
Example 7
Project: pai   File: ZookeeperStoreStructure.java   View Source Code Vote up 4 votes
public static String getNodePath(String parentNodePath, String nodeName) {
  return (StringUtils.stripEnd(parentNodePath, PATH_SEPARATOR) +
      PATH_SEPARATOR +
      StringUtils.stripStart(nodeName, PATH_SEPARATOR));
}
 
Example 8
Project: pai   File: WebStructure.java   View Source Code Vote up 4 votes
public static String getNodePath(String parentNodePath, String nodeName) {
  return (StringUtils.stripEnd(parentNodePath, PATH_SEPARATOR) +
      PATH_SEPARATOR +
      StringUtils.stripStart(nodeName, PATH_SEPARATOR));
}
 
Example 9
Project: monarch   File: IntegratedSecurityService.java   View Source Code Vote up 4 votes
public void authorize(String resource, String operation, String regionName, String key) {
  regionName = StringUtils.stripStart(regionName, "/");
  authorize(new ResourcePermission(resource, operation, regionName, key));
}