Skip to content

Commit 4b12a27

Browse files
author
Sven Ulrich
committed
updatedeps: docs
1 parent 63aa0b6 commit 4b12a27

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,44 @@ The class `String` is still available, but will be removed in the future.
2222

2323
#### USAGE:
2424

25-
### String.empty
25+
### $String.empty
2626
```typescript
27-
var id = String.empty;
27+
var id = $String.empty;
2828
```
2929

30-
### String.isNullOrWhiteSpace():
30+
### $String.isNullOrWhiteSpace():
3131
```typescript
3232
var id = image.GetId();
33-
if(String.isNullOrWhiteSpace(id))
33+
if($String.isNullOrWhiteSpace(id))
3434
return image;
3535
```
36-
### String.format():
36+
### $String.format():
3737

3838
```typescript
3939
var id = image.GetId()
40-
String.format("image_{0}.jpg", id)
40+
$String.format("image_{0}.jpg", id)
4141
output: "image_2db5da20-1c5d-4f1a-8fd4-b41e34c8c5b5.jpg";
4242
```
4343

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

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

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

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

53-
value = String.format("{0:s}", "21.03.2017 22:15:01") //output "2017-03-21T22:15:01"
54-
55-
value = String.format("{0:n}", 1000000);
54+
value = $String.format("{0:n}", 1000000);
5655
//output "1.000.000"
5756

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

6261
## UPDATE
63-
#### String.format for Objects including specifiers
62+
#### $String.format for Objects including specifiers
6463

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

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

7574
```
@@ -89,18 +88,18 @@ String.format("the {type:U} is {color:L} shipped on {shippingDate:s} with an amo
8988
### String.Join():
9089

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

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

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

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

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

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

tests/tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { String, $String, StringBuilder } from '../index';
1+
import { $String, String, StringBuilder } from '../index';
22
import { Fruit } from './fruit';
33
import { expect } from 'chai';
44
import 'mocha';

0 commit comments

Comments
 (0)