forked from xxq250/Nasal-Interpreter
change parameter name in native function split.
This commit is contained in:
@@ -34,11 +34,11 @@ var input=func(){
|
|||||||
return __builtin_input();
|
return __builtin_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
# split a string by delimiter for example:
|
# split a string by separator for example:
|
||||||
# split("ll","hello world") -> ["he","o world"]
|
# split("ll","hello world") -> ["he","o world"]
|
||||||
# this function will return a vector.
|
# this function will return a vector.
|
||||||
var split=func(deli,str){
|
var split=func(separator,str){
|
||||||
return __builtin_split(deli,str);
|
return __builtin_split(separator,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
# rand has the same function as the rand in C
|
# rand has the same function as the rand in C
|
||||||
|
|||||||
+2
-2
@@ -267,9 +267,9 @@ nasal_ref builtin_split(nasal_ref* local,nasal_gc& gc)
|
|||||||
nasal_ref deli_val=local[1];
|
nasal_ref deli_val=local[1];
|
||||||
nasal_ref str_val=local[2];
|
nasal_ref str_val=local[2];
|
||||||
if(deli_val.type!=vm_str)
|
if(deli_val.type!=vm_str)
|
||||||
return builtin_err("split","\"delimeter\" must be string");
|
return builtin_err("split","\"separator\" must be string");
|
||||||
if(str_val.type!=vm_str)
|
if(str_val.type!=vm_str)
|
||||||
return builtin_err("split","\"string\" must be string");
|
return builtin_err("split","\"str\" must be string");
|
||||||
std::string& delimeter=*deli_val.str();
|
std::string& delimeter=*deli_val.str();
|
||||||
std::string& source=*str_val.str();
|
std::string& source=*str_val.str();
|
||||||
size_t delimeter_len=delimeter.length();
|
size_t delimeter_len=delimeter.length();
|
||||||
|
|||||||
+3
-3
@@ -34,11 +34,11 @@ var input=func(){
|
|||||||
return __builtin_input();
|
return __builtin_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
# split a string by delimiter for example:
|
# split a string by separator for example:
|
||||||
# split("ll","hello world") -> ["he","o world"]
|
# split("ll","hello world") -> ["he","o world"]
|
||||||
# this function will return a vector.
|
# this function will return a vector.
|
||||||
var split=func(deli,str){
|
var split=func(separator,str){
|
||||||
return __builtin_split(deli,str);
|
return __builtin_split(separator,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
# rand has the same function as the rand in C
|
# rand has the same function as the rand in C
|
||||||
|
|||||||
Reference in New Issue
Block a user