Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xotic750/string-starts-with-x
Determines whether a string begins with the characters of a specified string.
https://github.com/xotic750/string-starts-with-x
browser javascript nodejs startswith string
Last synced: about 1 month ago
JSON representation
Determines whether a string begins with the characters of a specified string.
- Host: GitHub
- URL: https://github.com/xotic750/string-starts-with-x
- Owner: Xotic750
- License: mit
- Created: 2017-08-24T07:42:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:58:54.000Z (almost 2 years ago)
- Last Synced: 2024-11-16T22:09:01.316Z (about 1 month ago)
- Topics: browser, javascript, nodejs, startswith, string
- Language: JavaScript
- Size: 2.52 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## string-starts-with-x
Determines whether a string begins with the characters of a specified string.
### `module.exports` ⇒
boolean
⏏This method determines whether a string begins with the characters of a
specified string, returning true or false as appropriate.**Kind**: Exported member
**Returns**:boolean
- `true` if the given characters are found at the beginning
of the string; otherwise, `false`.
**Throws**:-
TypeError
If string is null or undefined.
-TypeError
If searchString is a RegExp.| Param | Type | Description |
| ------------ | ------------------- | ---------------------------------------------------------------------------------------- |
| string |string
| The string to be search. |
| searchString |string
| The characters to be searched for at the start of this string. |
| [position] |number
| The position in this string at which to begin searching for searchString; defaults to 0. |**Example**
```js
import startsWith from 'string-starts-with-x';const str = 'To be, or not to be, that is the question.';
startsWith(str, 'To be'); // true
startsWith(str, 'not to be'); // false
startsWith(str, 'not to be', 10); // true
```