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


Java StringUtils.indexOf方法代码示例

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


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

示例1: getVirtualFile

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private void getVirtualFile(String sourceName, VirtualFile virtualFile[], String compileRoot)
        throws Exception {
    if (!ArrayUtils.isEmpty(virtualFile)) {
        VirtualFile arr$[] = virtualFile;
        int len$ = arr$.length;
        for (int i$ = 0; i$ < len$; i$++) {
            VirtualFile vf = arr$[i$];
            String srcName;
            if (StringUtils.indexOf(vf.toString(), "$") != -1)
                srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.indexOf(vf.toString(), "$"));
            else
                srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.length(vf.toString()) - 6);
            String dstName = StringUtils.substring(sourceName, 0, StringUtils.length(sourceName) - 5);
            if (StringUtils.equals(srcName, dstName)) {
                String outRoot = (new StringBuilder()).append(StringUtils.substring(compileRoot, 0, StringUtils.lastIndexOf(compileRoot, "/"))).append("/out").toString();
                String packagePath = StringUtils.substring(vf.getPath(), StringUtils.length(compileRoot), StringUtils.length(vf.getPath()));
                File s = new File(vf.getPath());
                File t = new File((new StringBuilder()).append(outRoot).append(packagePath).toString());
                FileUtil.copy(s, t);
            }
            if (!ArrayUtils.isEmpty(virtualFile))
                getVirtualFile(sourceName, vf.getChildren(), compileRoot);
        }

    }
}
 
开发者ID:serical,项目名称:patcher,代码行数:27,代码来源:ClassesExportAction.java

示例2: getBriefFromCommentText

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
protected String getBriefFromCommentText(String commentText) {
	int index = StringUtils.indexOf(commentText, '\n');
	if (index != -1) {
		commentText = StringUtils.substring(commentText, 0, index);
	}
	index = StringUtils.indexOfAny(commentText, ".!?。!?…");
	if (index > 0) {
		commentText = StringUtils.substring(commentText, 0, index);
	}
	if (StringUtils.length(commentText) > 8) {
		commentText = StringUtils.substring(commentText, 0, 8) + "…";
	}
	return commentText;
}
 
开发者ID:WinRoad-NET,项目名称:wrdocletbase,代码行数:15,代码来源:AbstractDocBuilder.java

示例3: nextButtonListener

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * The function will move the cursor in forward direction.
 * @param styledText
 * @param text
 * @param prevLineIndex
 * @param nextLineIndex
 * @return int[]
 */
public int[] nextButtonListener(StyledText styledText, String text, int prevLineIndex, int nextLineIndex){
	logger.debug("StyledText next button selected");
	int txtIndex = StringUtils.indexOf(StringUtils.lowerCase(styledText.getText()), StringUtils.lowerCase(text), nextLineIndex);
	
	if(txtIndex < 0){
		nextLineIndex = 0;
		prevLineIndex =  StringUtils.indexOf(StringUtils.lowerCase(styledText.getText()), StringUtils.lowerCase(text), nextLineIndex);
		nextLineIndex = prevLineIndex + 1;
		styledText.setSelection(prevLineIndex);
		setStyledRange(styledText, prevLineIndex, text.length(), null, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
		return new int[]{prevLineIndex,nextLineIndex};
	}else{
		setStyledRange(styledText, txtIndex, text.length(), null, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
		styledText.setSelection(txtIndex);
		prevLineIndex = txtIndex;
		nextLineIndex = txtIndex+1;
		styledText.redraw();
	}
	return new int[]{prevLineIndex,nextLineIndex};
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:29,代码来源:StyledTextEventListener.java

示例4: allButtonListener

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * The function will change selected text background color.
 * @param styledText
 * @param text
 * @param foreground
 * @param background
 */
public void allButtonListener(StyledText styledText, String text, Color foreground, Color background, Label label){
	logger.debug("StyledText All button selected");
	int index = 0;
	int recordCount = 0;
	if(styledText == null){return;}
	for(;index < styledText.getText().length();){
		  int lastIndex = StringUtils.indexOf(StringUtils.lowerCase(styledText.getText()), StringUtils.lowerCase(text), index);
		  
		  if(lastIndex < 0){return;}
		  else{
			  setStyledRange(styledText, lastIndex, text.length(), null, background);
			  index = lastIndex + 1;
			  recordCount++ ;
			  label.setVisible(true);
			  label.setText("Matching count - " + recordCount);
		  }
	  }
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:StyledTextEventListener.java

示例5: indexOfSignChars

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Index of sign charaters (i.e. '+' or '-').
 * 
 * @param str The string to search
 * @param startPos The start position
 * @return the index of the first sign character or -1 if not found
 */
private static int indexOfSignChars(String str, int startPos) {
    int idx = StringUtils.indexOf(str, '+', startPos);
    if (idx < 0) {
        idx = StringUtils.indexOf(str, '-', startPos);
    }
    return idx;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DateUtils.java

示例6: getFailedMessage

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public String getFailedMessage(int max) {
  int count = 0;
  StringBuilder stringBuilder = new StringBuilder();
  for (Map.Entry<String, String> entry : failed.entrySet()) {
    if (StringUtils.indexOf(entry.getValue(), "VersionConflictEngineException") < 0) {
      stringBuilder.append(String.format("id:%s error:%s", entry.getKey(), entry.getValue()));
      count++;
      if (count >= max) {
        break;
      }
    }
  }
  return stringBuilder.toString();
}
 
开发者ID:pinterest,项目名称:soundwave,代码行数:15,代码来源:EsBulkResponseSummary.java

示例7: isTextExist

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private boolean isTextExist(StyledText styledText, String text){
	if(StringUtils.isNotBlank(styledText.getText())){
		int textIndex = StringUtils.indexOf(StringUtils.lowerCase(styledText.getText()), StringUtils.lowerCase(text), 0);
		if(textIndex < 0){
			label.setVisible(true);
			label.setText(labelText);
			return true;
		}else{
			label.setVisible(false);
			return false;
		}
	}else{ return false;}
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:FindViewDataDialog.java

示例8: fieldEofResponse

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, List<FieldPacket> fieldPackets,
                             byte[] eofNull, boolean isLeft, BackendConnection conn) {
    lock.lock();
    try {
        if (terminate.get())
            return;
        this.fieldPackets = fieldPackets;
        this.sourceFields = HandlerTool.createFields(this.fieldPackets);
        for (Item sel : selects) {
            Item tmpItem = HandlerTool.createItem(sel, this.sourceFields, 0, isAllPushDown(), type());
            tmpItem.setItemName(sel.getItemName());
            String selAlias = sel.getAlias();
            if (selAlias != null || tableAlias != null) {
                // remove the added tmp FNAF
                if (StringUtils.indexOf(selAlias, Item.FNAF) == 0)
                    selAlias = StringUtils.substring(selAlias, Item.FNAF.length());
            }
            tmpItem = HandlerTool.createRefItem(tmpItem, schema, table, tableAlias, selAlias);
            this.selItems.add(tmpItem);
        }
        List<FieldPacket> newFieldPackets = new ArrayList<>();
        for (Item selItem : this.selItems) {
            FieldPacket tmpFp = new FieldPacket();
            selItem.makeField(tmpFp);
            /* Keep things compatible for old clients */
            if (tmpFp.getType() == FieldTypes.MYSQL_TYPE_VARCHAR.numberValue())
                tmpFp.setType(FieldTypes.MYSQL_TYPE_VAR_STRING.numberValue());
            newFieldPackets.add(tmpFp);
        }
        nextHandler.fieldEofResponse(null, null, newFieldPackets, null, this.isLeft, conn);
    } finally {
        lock.unlock();
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:36,代码来源:SendMakeHandler.java

示例9: convertGridRowToJaxbSchemaField

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Converts UI grid-row object to its equivalent Jaxb Object
 * 
 * @param gridRow
 * @return
 */
public Field convertGridRowToJaxbSchemaField(GridRow gridRow) {
	Field field = new Field();
	if (StringUtils.indexOf(gridRow.getFieldName(), "}") - StringUtils.indexOf(gridRow.getFieldName(), "@{") >= 3) {
		Utils.INSTANCE.loadProperties();
		String paramValue = Utils.INSTANCE.getParamValueForRunSql(gridRow.getFieldName());
		field.setName(paramValue);
	} else {
		field.setName(gridRow.getFieldName());
	}
	field.setType(FieldDataTypes.fromValue(gridRow.getDataTypeValue()));
	
	if(gridRow instanceof XPathGridRow){
		if(StringUtils.isNotBlank(((XPathGridRow)gridRow).getXPath())){
			field.setAbsoluteOrRelativeXpath((((XPathGridRow)gridRow).getXPath()));
		}
	}
	
	if(StringUtils.isNotBlank(gridRow.getDateFormat())){
		field.setFormat(gridRow.getDateFormat());
	}
	if(StringUtils.isNotBlank(gridRow.getPrecision())){
		field.setPrecision(Integer.parseInt(gridRow.getPrecision()));
	}
	if(StringUtils.isNotBlank(gridRow.getScale())){
		field.setScale(Integer.parseInt(gridRow.getScale()));
	}
	if(gridRow.getScaleTypeValue()!=null){
		if(!gridRow.getScaleTypeValue().equals("") && !gridRow.getScaleTypeValue().equals(Messages.SCALE_TYPE_NONE)){
			field.setScaleType(ScaleTypes.fromValue(gridRow.getScaleTypeValue()));
		}
	}
	if(StringUtils.isNotBlank(gridRow.getDescription())){
		field.setDescription(gridRow.getDescription());
	}

	if(gridRow instanceof FixedWidthGridRow){
		if(StringUtils.isNotBlank(((FixedWidthGridRow)gridRow).getLength())){
			field.setLength(new BigInteger(((FixedWidthGridRow)gridRow).getLength()));
		}
	}
	
	if(gridRow instanceof MixedSchemeGridRow){
		if(StringUtils.isNotBlank(((MixedSchemeGridRow)gridRow).getLength())){
			field.setLength(new BigInteger(((MixedSchemeGridRow)gridRow).getLength()));
		}
		
		if(StringUtils.isNotBlank(((MixedSchemeGridRow)gridRow).getDelimiter())){
			field.setDelimiter((((MixedSchemeGridRow)gridRow).getDelimiter()));
		}

	}

	if(gridRow instanceof GenerateRecordSchemaGridRow){
		if(StringUtils.isNotBlank(((GenerateRecordSchemaGridRow)gridRow).getLength())){
			field.setLength(new BigInteger(((GenerateRecordSchemaGridRow)gridRow).getLength()));
		}
		if(StringUtils.isNotBlank(((GenerateRecordSchemaGridRow) gridRow).getRangeFrom())){
			field.setRangeFrom((((GenerateRecordSchemaGridRow) gridRow).getRangeFrom()));
		}
		if(StringUtils.isNotBlank(((GenerateRecordSchemaGridRow) gridRow).getRangeTo())){
			field.setRangeTo(((GenerateRecordSchemaGridRow) gridRow).getRangeTo());
		}
		if(StringUtils.isNotBlank(((GenerateRecordSchemaGridRow) gridRow).getDefaultValue())){
			field.setDefault(((GenerateRecordSchemaGridRow) gridRow).getDefaultValue());
		}
	}
	return field;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:75,代码来源:ExternalSchemaUtil.java


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