Skip to content

Commit 51f17d1

Browse files
author
Sven Ulrich
committed
updatedeps: docs
1 parent 4b12a27 commit 51f17d1

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

README.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,57 @@
88
# Simple lightweight string operation library for Typescript.
99
## No jQuery required! Unit tested, works with Angular.
1010

11-
I recently got feedback that sometimes there are issues when using `String`, since its actually replacing the native `String` object from JavaScript. You can use `$String` instead.
1211

1312
```typescript
14-
import { $String, StringBuilder } from 'typescript-string-operations';
13+
import { String, StringBuilder } from 'typescript-string-operations';
1514
```
1615

17-
The class `String` is still available, but will be removed in the future.
16+
I recently got feedback that sometimes there are issues when using `String`, since its actually replacing the native `String` object from JavaScript. You can use `$String` instead.
1817

1918
```typescript
20-
import { String } from 'typescript-string-operations';
19+
import { $String } from 'typescript-string-operations';
2120
```
2221

2322
#### USAGE:
2423

25-
### $String.empty
24+
### String.empty
2625
```typescript
27-
var id = $String.empty;
26+
var id = String.empty;
2827
```
2928

30-
### $String.isNullOrWhiteSpace():
29+
### String.isNullOrWhiteSpace():
3130
```typescript
3231
var id = image.GetId();
33-
if($String.isNullOrWhiteSpace(id))
32+
if(String.isNullOrWhiteSpace(id))
3433
return image;
3534
```
36-
### $String.format():
35+
### String.format():
3736

3837
```typescript
3938
var id = image.GetId()
40-
$String.format("image_{0}.jpg", id)
39+
String.format("image_{0}.jpg", id)
4140
output: "image_2db5da20-1c5d-4f1a-8fd4-b41e34c8c5b5.jpg";
4241
```
4342

4443
Specifier available!
4544
```typescript
46-
var value = $String.format("{0:L}", "APPLE"); //output "apple"
45+
var value = String.format("{0:L}", "APPLE"); //output "apple"
4746

48-
value = $String.format("{0:U}", "apple"); // output "APPLE"
47+
value = String.format("{0:U}", "apple"); // output "APPLE"
4948

50-
value = $String.format("{0:d}", "2017-01-23 00:00"); //output "23.01.2017"
49+
value = String.format("{0:d}", "2017-01-23 00:00"); //output "23.01.2017"
5150

52-
value = $String.format("{0:s}", "21.03.2017 22:15:01") //output "2017-03-21T22:15:01"
51+
value = String.format("{0:s}", "21.03.2017 22:15:01") //output "2017-03-21T22:15:01"
5352

54-
value = $String.format("{0:n}", 1000000);
53+
value = String.format("{0:n}", 1000000);
5554
//output "1.000.000"
5655

57-
value = $String.format("{0:00}", 1);
56+
value = String.format("{0:00}", 1);
5857
//output "01"
5958
```
6059

6160
## UPDATE
62-
#### $String.format for Objects including specifiers
61+
#### String.format for Objects including specifiers
6362

6463
```typescript
6564
var fruit = new Fruit();
@@ -68,7 +67,7 @@ fruit.color = "RED";
6867
fruit.shippingDate = new Date(2018, 1, 1);
6968
fruit.amount = 10000;
7069

71-
$String.format("the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}", fruit);
70+
String.format("the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}", fruit);
7271
// output: the APPLE is red shipped on 2018-01-01 with an amount of 10.000
7372

7473
```
@@ -88,18 +87,18 @@ $String.format("the {type:U} is {color:L} shipped on {shippingDate:s} with an am
8887
### String.Join():
8988

9089
```typescript
91-
var value = $String.join("; ", "Apple", "Banana");
90+
var value = String.join("; ", "Apple", "Banana");
9291
//output: "Apple; Banana";
9392
```
9493
#### OR
9594

9695
```typescript
9796
let object = { Name: "Foo", Value: "Bar" };
98-
var value = $String.join('.', object);
97+
var value = String.join('.', object);
9998
//output: "Foo.Bar";
10099

101100
var array = ['Apple', 'Banana']
102-
var value = $String.join("; ", array);
101+
var value = String.join("; ", array);
103102
//output: "Apple; Banana";
104103
```
105104

@@ -127,7 +126,7 @@ var builder = new StringBuilder("My favorite fruits are: ");
127126
builder.Append("Apples, ");
128127
builder.Append("Bananas ");
129128

130-
// using $String.Format() internally
129+
// using String.Format() internally
131130
builder.AppendFormat("and especially {0:U}!", favoriteFruit);
132131
builder.AppendFormat(" I eat {0} every day!", 10);
133132

@@ -141,8 +140,8 @@ var fruits = builder.ToString();
141140
| Method | Type | Description | Parameter |
142141
| :------------------------:|:-----------:|:--------------------------:|:----------:|
143142
| `Append` | `Method` | appends a string. | `value` |
144-
| `AppendFormat` | `Method` | see description for `$String.format()`| `format`, `args`|
143+
| `AppendFormat` | `Method` | see description for `String.format()`| `format`, `args`|
145144
| `AppendLine` | `Method` | appends a string in a new line. | `format`, `args`|
146-
| `AppendLineFormat` | `Method` | like `$String.format()` in a new line | `format`, `args`|
145+
| `AppendLineFormat` | `Method` | like `String.format()` in a new line | `format`, `args`|
147146
| `Clear` | `Method` | clears the `StringBuilder` | |
148147
| `ToString` | `Method` | creates the actual string. | |

string.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ export declare class $String {
66
static format(format: string, ...args: any[]): string;
77
}
88

9-
/**
10-
* @deprecated String is overriding the native `String` object, this class will be removed in the future! Use `$String` instead.
11-
*/
129
export declare class String extends $String {
1310
/**
1411
* @deprecated The property should not be used, and will be removed in future versions! Use `String.empty` instead.

0 commit comments

Comments
 (0)