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

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

源代码1 项目: submarine   文件: ResourceUtils.java
/**
 * Extract unit and actual value from resource value.
 * @param resourceValue Value of the resource
 * @return Array containing unit and value. [0]=unit, [1]=value
 * @throws IllegalArgumentException if units contain non alpha characters
 */
private static String[] parseResourceValue(String resourceValue) {
  String[] resource = new String[2];
  int i = 0;
  for (; i < resourceValue.length(); i++) {
    if (Character.isAlphabetic(resourceValue.charAt(i))) {
      break;
    }
  }
  String units = resourceValue.substring(i);

  if (StringUtils.isAlpha(units) || units.equals("")) {
    resource[0] = units;
    resource[1] = resourceValue.substring(0, i);
    return resource;
  } else {
    throw new IllegalArgumentException("Units '" + units + "'"
        + " contains non alphabet characters, which is not allowed.");
  }
}
 
源代码2 项目: pmd-designer   文件: XPathAutocompleteProvider.java
@Nullable
private Tuple2<Integer, String> getInsertionPointAndQuery(int searchPoint) {
    String input = myCodeArea.getText();

    int insertionPoint = getInsertionPoint(searchPoint, input);

    if (searchPoint > input.length()) {
        searchPoint = input.length();
    }
    if (insertionPoint > searchPoint) {
        new StringIndexOutOfBoundsException("Cannot extract query from subtext \"" + input.substring(0, insertionPoint) + "\"").printStackTrace();
        return null;
    }

    // don't trim, if there is any whitespace we abort
    input = input.substring(insertionPoint, searchPoint);

    return StringUtils.isAlpha(input) ? Tuples.t(insertionPoint, input.trim()) : null;
}
 
源代码3 项目: VersionChecker   文件: NEMUtils.java
public static String patchVersion(String modVersion) {
    modVersion = modVersion.replaceAll(Pattern.quote("(" + NEMChecker.getMcVersion() + ")"), "");
    modVersion = modVersion.replaceAll(Pattern.quote("[" + NEMChecker.getMcVersion() + "]"), "");
    modVersion = modVersion.replaceAll("[\\)\\]]", "").replaceAll("[\\(\\[]", ".");
    modVersion = modVersion.replaceAll(Pattern.quote("_" + NEMChecker.getMcVersion()), "");
    modVersion = modVersion.replaceAll(Pattern.quote(NEMChecker.getMcVersion() + "_"), "");
    modVersion = modVersion.replaceAll(Pattern.quote(NEMChecker.getMcVersion() + "-"), "");
    modVersion = modVersion.replaceAll("^v", "").replaceAll("^V", "");
    modVersion = modVersion.replaceAll(" build ", ".").replaceAll("\\s","");

    int index = modVersion.lastIndexOf('-');
    if (index != -1)
    {
        String lastPart = modVersion.substring(index + 1);
        if (StringUtils.isAlpha(lastPart))
            modVersion = modVersion.substring(0, index);
    }

    return modVersion;
}
 
源代码4 项目: flink   文件: SqlFunctionUtils.java
public static boolean isAlpha(Object obj) {
	if (obj == null){
		return false;
	}
	if (!(obj instanceof String)){
		return false;
	}
	String s = obj.toString();
	if ("".equals(s)) {
		return false;
	}
	return StringUtils.isAlpha(s);
}
 
源代码5 项目: Spring   文件: CustomerServiceImpl.java
@Override
public Iterable<Customer> findCustomersByFNameLName(String firstName, String lastName) throws CustomerSerivceClientException {
	if(StringUtils.isEmpty(firstName) || StringUtils.isEmpty(lastName)) {
		throw new CustomerSerivceClientException("Missing required parameter!");
	} else if (!StringUtils.isAlpha(firstName) || !StringUtils.isAlpha(lastName)) {
		throw new CustomerSerivceClientException("First and/or last name is not in proper format!");
	}
	return repo.findCustomersByFirstNameAndLastName(firstName, lastName);
}
 
源代码6 项目: Spring   文件: CustomerServiceImpl.java
@Override
public Iterable<Customer> findCustomersByFNameLName(String firstName, String lastName) throws CustomerSerivceClientException {
	if(StringUtils.isEmpty(firstName) || StringUtils.isEmpty(lastName)) {
		throw new CustomerSerivceClientException("Missing required parameter!");
	} else if (!StringUtils.isAlpha(firstName) || !StringUtils.isAlpha(lastName)) {
		throw new CustomerSerivceClientException("First and/or last name is not in proper format!");
	}
	return repo.findCustomersByFirstNameAndLastName(firstName, lastName);
}
 
源代码7 项目: Spring   文件: CustomerServiceImpl.java
@Override
public Iterable<Customer> findCustomersByFNameLName(String firstName, String lastName) throws CustomerSerivceClientException {
	if(StringUtils.isEmpty(firstName) || StringUtils.isEmpty(lastName)) {
		throw new CustomerSerivceClientException("Missing required parameter!");
	} else if (!StringUtils.isAlpha(firstName) || !StringUtils.isAlpha(lastName)) {
		throw new CustomerSerivceClientException("First and/or last name is not in proper format!");
	}
	return repo.findCustomersByFirstNameAndLastName(firstName, lastName);
}
 
源代码8 项目: jdmn   文件: DefaultSignavioStringLib.java
public Boolean isAlpha(String text) {
    if (text == null) {
        return null;
    }

    return StringUtils.isAlpha(text);
}
 
源代码9 项目: flink   文件: SqlFunctionUtils.java
public static boolean isAlpha(Object obj) {
	if (obj == null){
		return false;
	}
	if (!(obj instanceof String)){
		return false;
	}
	String s = obj.toString();
	if ("".equals(s)) {
		return false;
	}
	return StringUtils.isAlpha(s);
}
 
源代码10 项目: jitsi   文件: UnknownContactPanel.java
/**
 * Initializes the call button.
 */
private void initSMSButton()
{
    if(parentWindow.hasOperationSet(OperationSetSmsMessaging.class)
        && !StringUtils.isAlpha(parentWindow.getCurrentSearchText()))
    {
        if (smsButton != null && smsButton.getParent() != null)
            return;

        smsButton = new JButton(GuiActivator.getResources()
            .getI18NString("service.gui.SEND_SMS"));

        smsButton.setIcon(GuiActivator.getResources()
            .getImage("service.gui.icons.SMS_BUTTON_ICON"));

        buttonPanel.add(smsButton);

        smsButton.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                final String searchText
                    = parentWindow.getCurrentSearchText();

                if(searchText == null)
                    return;

                SMSManager.sendSMS(smsButton, searchText);
            }
        });
    }
    else
    {
        if(smsButton != null)
            buttonPanel.remove(smsButton);
    }
}
 
源代码11 项目: vscrawler   文件: IsAlpha.java
@Override
protected  boolean handle(CharSequence str) {
    return StringUtils.isAlpha(str);
}
 
 同类方法