You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

typescript-string-operations

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-string-operations - npm Package Compare versions

Comparing version

to
1.1.3

7

package.json
{
"name": "typescript-string-operations",
"version": "1.1.2",
"version": "1.1.3",
"description": "Simple lightweight string operation library for Typescript",

@@ -16,3 +16,6 @@ "main": "source.ts",

"typescript",
"string format"
"string format",
"string operations",
"stringbuilder",
"string builder"
],

@@ -19,0 +22,0 @@ "author": "Sven Ulrich <sven_ulrich@gmx.net> (holdmybeer.de)",

@@ -6,2 +6,3 @@ # Readme for developers

1. clone this repo
1. execute `npm install -g gulp`
1. execute `npm install`

@@ -8,0 +9,0 @@ 1. code!

[![NPM](https://nodei.co/npm/typescript-string-operations.png?mini=true)](https://www.npmjs.com/package/typescript-string-operations)
# Simple lightweight string operation library for Typescript.
#### No jQuery required. Unit tested.
```typescript
import { String, StringBuilder } from 'typescript-string-operations';
```
#### USAGE:

@@ -57,3 +62,4 @@

#### OR
```typscript
```typescript
var array = ['Apple', 'Banana']

@@ -73,1 +79,32 @@ var value = String.Join("; ", array);

| `Join` | `Method` | Combines arguments delimited by given seperator from array. | `delimiter`,`array` |
### StringBuilder
Just like you know from C#,
```typescript
var favoriteFruit: string = this.fruiteService.getFavorite(); //Blueberries
var builder = new StringBuilder("My favorite fruits are: ");
builder.Append("Apples, ");
builder.Append("Bananas ");
// of course using String.Format()
builder.AppendFormat("and especially {0:U}!", favoriteFruit);
builder.AppendFormat(" I eat {0} every day!", 10);
var fruits = builder.ToString();
//output: "My favorite fruits are: Apples, Bananas and especially Blueberries! I eat 10 every day!";
```
## Methods
| Method | Type | Description | Parameter |
| :------------------------:|:-----------:|:--------------------------:|:----------:|
| `Append` | `Method` | appends a string. | `value` |
| `AppendFormat` | `Method` | see description for `String.Format()`| `format`, `args`|
| `Clear` | `Method` | clears the `StringBuilder` | |

@@ -13,4 +13,4 @@ export class StringBuilder {

}
public AppendFormat(value: string, ...args: string[]) {
this.Values.push(String.Format(value, ...args));
public AppendFormat(format: string, ...args: any[]) {
this.Values.push(String.Format(format, ...args));
}

@@ -17,0 +17,0 @@ public Clear() {