Array Delimiter(Deliminate last number or string with "and" or "or")
- Install React Delimiter as a dependency
# NPM
$ npm install react-delimiter
- Import the
react-delimiter
module
// ES6
import { delimiter } from "react-delimiter";
import { delimiter } from 'react-delimiter';
render() {
<h4>{delimiter([1, 2, 3], "and")}</h4>
}
{
array=[1,2,3],
string= "and" or "or"
}
Input | Output |
---|---|
delimiter([1, 2, 3], "and") | 1, 2 and 3 |
delimiter([1, 2, 3], "or") | 1, 2 or 3 |
delimiter([1, 2], "or") | 1 or 2 |
delimiter([1, 2], "and") | 1 and 2 |
delimiter([1], "or") | 1 |
delimiter([1], "and") | 1 |
array
- Array of Numbers or StringsString
- String (Deliminate number or string by this string)