Method `/()
- Method `/
mixed`/(objectarg1,mixedarg2)
mixed`/(mixedarg1,objectarg2)
array(string) `/(stringarg1,intarg2)
array(string) `/(stringarg1,floatarg2)
array(array) `/(arrayarg1,intarg2)
array(array) `/(arrayarg1,floatarg2)
array(string) `/(stringarg1,stringarg2)
array(array) `/(arrayarg1,arrayarg2)
float`/(floatarg1,int|floatarg2)
float`/(intarg1,floatarg2)
int`/(intarg1,intarg2)
mixed`/(mixedarg1,mixedarg2,mixed...extras)- Description
Division/split.
Every expression with the
/operator becomes a call to this function, i.e.a/bis the same aspredef::`/(a,b).- Returns
If there are more than two arguments, the result will be
`/(`/(.arg1,arg2), @extras)If
arg1is an object that implements lfun::`/(), that function will be called witharg2as the single argument.If
arg2is an object that implements lfun::``/(), that function will be called witharg1as the single argument.Otherwise the result will be as follows:
arg1can have any of the following types:stringarg2can have any of the following types:int|floatThe result will be and array of
arg1split in segments of lengtharg2. Ifarg2is negative the splitting will start from the end ofarg1.stringThe result will be an array of
arg1split at each occurrence ofarg2. Note that the segments that matched againstarg2will not be in the result.arrayarg2can have any of the following types:int|floatThe result will be and array of
arg1split in segments of lengtharg2. Ifarg2is negative the splitting will start from the end ofarg1.arrayThe result will be an array of
arg1split at each occurrence ofarg2. Note that the elements that matched againstarg2will not be in the result.float|intThe result will be
. If both arguments are int, the result will be truncated to an int. Otherwise the result will be a float.arg1/arg2- Note
Unlike in some languages, the function f(x) = x/n (x and n integers) behaves in a well-defined way and is always rounded down. When you increase x, f(x) will increase with one for each n:th increment. For all x, (x + n) / n = x/n + 1; crossing zero is not special. This also means that / and % are compatible, so that a = b*(a/b) + a%b for all a and b.
- See also