2 changed files with 45 additions and 8 deletions
@ -0,0 +1,37 @@ |
|||||||
|
package com.fr.solution.plugin.design.formula.compat; |
||||||
|
|
||||||
|
import com.fanruan.api.util.StringKit; |
||||||
|
import com.fr.design.formula.NameAndDescription; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author richie |
||||||
|
* @version 10.0 |
||||||
|
* Created by richie on 2019-09-03 |
||||||
|
*/ |
||||||
|
public abstract class AbstractNameAndDescription implements NameAndDescription { |
||||||
|
|
||||||
|
@Override |
||||||
|
public String searchResult(String keyWord, boolean findDescription) { |
||||||
|
String functionName = getName(); |
||||||
|
if (StringKit.isBlank(functionName)) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
int sign = 1; |
||||||
|
int length = keyWord.length(); |
||||||
|
String temp = functionName.toUpperCase(); |
||||||
|
for (int j = 0; j < length; j++) { |
||||||
|
String check = keyWord.substring(j, j + 1); |
||||||
|
int index = temp.indexOf(check.toUpperCase()); |
||||||
|
if (index == -1) { |
||||||
|
sign = 0; |
||||||
|
break; |
||||||
|
} else { |
||||||
|
temp = temp.substring(index + 1); |
||||||
|
} |
||||||
|
} |
||||||
|
if (sign == 1) { |
||||||
|
return functionName; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue