Skip to content

Commit

Permalink
read me created by gs
Browse files Browse the repository at this point in the history
  • Loading branch information
GobindaSaha committed Sep 23, 2019
1 parent da50ad8 commit e9b8e21
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ $ npm i string-manipulation
## Usage

In your ts file include the package as -<br />
```js
import * as str from 'string-manipulation';

``` js
import * as str from 'string-manipulation';
```

After importing the package from node_modules use 'str' attribute as an instance of the module. Like -
Expand All @@ -45,10 +46,80 @@ str.randomReadableStr(); //it will generate random string at a time

## Methods

### str.overwriteStr(start: number, end: number, replaceWith: string)
Replaces the characters from `start` to `end` with `replaceWith` .

### str.appendStrToEnd(appendWith: string)
Appends the specified `appendWith` to the end of the string. Returns `this` .

### str.appendStrToStart(appendWith: string)
Appends the specified `appendWith` at the start of the original string.

### str.appendStrToIndex(index: number, appendWith: string)
Appends the specified `appendWith` at the `index` in the original string.

### str.cloneStr()
Simply returns the duplicate string of the speciefied one.

### str.moveStr(start: number, end: number, indexPosition: number)
Moves the characters from `start` and `end` to `indexPosition`. Returns `this`.

### str.removeStr(start: number, end: number)
Removes the characters from `start` to `end` (of the original string, **not** the generated string). Removing the same content twice, or making removals that partially overlap, will cause an error. Returns `this`.

### str.sliceStr(start: number, end: number)
Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string. Throws error if the indices are for characters that were already removed.

### str.snipStr(start: number, end: number)
Returns a clone of `str`, with all content before the `start` and `end` characters of the original string removed.

### str.trimStr(characterToBeTrimmed: string)
Trims content matching `characterToBeTrimmed` (defaults to `\s`, i.e. whitespace) from the start and end. Returns `this`.

### str.trimStrFromStart(characterToBeTrimmed: string)
Trims content matching `characterToBeTrimmed` (defaults to `\s`, i.e. whitespace) from the start. Returns `this`.

### str.trimStrFromEnd(characterToBeTrimmed: string)
Trims content matching `characterToBeTrimmed` (defaults to `\s`, i.e. whitespace) from the end. Returns `this`.

### str.emptyStrCheck()
Returns true if the resulting source is empty (disregarding white space).

### str.replaceStr(replaceStr: string, replaceWith: string)
Replaces `replaceStr` with `replaceWith` in sentence and returns it.

### str.lengthStr()
Returns the length of a string in numbers.

### str.concatStr(str1: string, str2: string)
Concates two strings (i.e `str1` and `str2`) and returns it.

### str.returnChar(numeric: number)
It converts and returns the given number into a form of ASCII character.

### str.wordContainStr(word: string)
Returns `true` if the passing `word` gets mached with the contents of the original string. Else returns `false`.

### str.charPositionInStr(position: number)
Returns a character from a string matching the index position by `position`.

### str.indexOfStr(searchStr: string)
Returns index position of a given character(i.e `searchStr`) from a string.

### str.repeatStr(times: number)
Repeates the string for given times and returns the repeated string in an appending form.

### str.toLowerCaseStr()
Converts string to a lower-case form.

### str.toUpperCaseStr()
Converts string to a upper-case form.

### randomReadableStr()
Generates a random string in human-readable form.

## License

MIT © Gobinda <br />
[License](LICENSE)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "string-manipulation",
"version": "1.2.8",
"version": "1.2.9",
"description": "A plugin for string as well as number manipulation. Use the method and pass the value to it to get the desired value.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit e9b8e21

Please sign in to comment.