mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
optimize strIsContain and strPointToLastToken
This commit is contained in:
parent
9ea03893b6
commit
24a6e50feb
@ -111,6 +111,9 @@ size_t strGetSize(char* pData) {
|
||||
}
|
||||
|
||||
char* strPointToLastToken(char* strIn, char sign) {
|
||||
if(!strIsContain(strIn, sign)){
|
||||
return strIn;
|
||||
}
|
||||
int32_t size = strGetSize(strIn);
|
||||
for (int32_t i = size - 1; i > -1; i--) {
|
||||
if (strIn[i] == sign) {
|
||||
@ -214,11 +217,11 @@ char* strRemovePrefix(char* inputStr, char* prefix, char* outputStr) {
|
||||
}
|
||||
|
||||
int32_t strIsContain(char* str, char ch) {
|
||||
size_t len = strGetSize(str);
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
if (str[i] == ch) {
|
||||
while(*str){
|
||||
if (*str == ch){
|
||||
return 1;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ impl MethodInfo {
|
||||
|
||||
define.push_str(
|
||||
format!(
|
||||
" {}(self, \"{}\", \"{}\", \n {}_{}Method);\n",
|
||||
" {}(self, \"{}\", \"{}\", \n {}_{}Method);\n\n",
|
||||
class_define_method, self.name, arg_list, self.class_name, self.name
|
||||
)
|
||||
.as_str(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user