Adding basic search to the text editor
This commit is contained in:
parent
8e05690ef3
commit
4a62774a57
3 changed files with 131 additions and 15 deletions
|
|
@ -79,6 +79,14 @@ export const _rt = {
|
|||
return String(value);
|
||||
},
|
||||
chars: (s: string) => s.split(''),
|
||||
strIndexOf: (needle: string) => (haystack: string) => (start: number) => {
|
||||
const i = haystack.indexOf(needle, start);
|
||||
return i === -1 ? { _tag: 'None' } : { _tag: 'Some', _0: i };
|
||||
},
|
||||
strLastIndexOf: (needle: string) => (haystack: string) => {
|
||||
const i = haystack.lastIndexOf(needle);
|
||||
return i === -1 ? { _tag: 'None' } : { _tag: 'Some', _0: i };
|
||||
},
|
||||
isWordChar: (s: string) => ({ _tag: /^\w$/.test(s) ? 'True' : 'False' }),
|
||||
// join: (delim: string) => (xs: string[]) => xs.join(delim),
|
||||
split: (delim: string) => (xs: string) => xs.split(delim),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue