1
- import { String , StringBuilder , isNullOrWhiteSpace , format , join } from '..' ;
1
+ import { String , StringBuilder , isNullOrWhiteSpace , formatString , joinString } from '..' ;
2
2
import { Fruit } from './fruit' ;
3
3
import { expect } from 'chai' ;
4
4
import 'mocha' ;
@@ -57,7 +57,7 @@ describe('String.Format Number Pattern', () => {
57
57
expect ( result ) . to . equal ( template ) ;
58
58
result = String . format ( template , valueToInsert ) ;
59
59
expect ( result ) . to . equal ( template ) ;
60
- result = format ( template , valueToInsert ) ;
60
+ result = formatString ( template , valueToInsert ) ;
61
61
expect ( result ) . to . equal ( template ) ;
62
62
} ) ;
63
63
@@ -68,7 +68,7 @@ describe('String.Format Number Pattern', () => {
68
68
expect ( result ) . to . equal ( valueToInsert ) ;
69
69
result = String . format ( template , valueToInsert ) ;
70
70
expect ( result ) . to . equal ( valueToInsert ) ;
71
- result = format ( template , valueToInsert ) ;
71
+ result = formatString ( template , valueToInsert ) ;
72
72
expect ( result ) . to . equal ( valueToInsert ) ;
73
73
} ) ;
74
74
@@ -80,7 +80,7 @@ describe('String.Format Number Pattern', () => {
80
80
expect ( result ) . to . equal ( expectedValue ) ;
81
81
result = String . format ( template , valueToInsert ) ;
82
82
expect ( result ) . to . equal ( expectedValue ) ;
83
- result = format ( template , valueToInsert ) ;
83
+ result = formatString ( template , valueToInsert ) ;
84
84
expect ( result ) . to . equal ( expectedValue ) ;
85
85
} ) ;
86
86
@@ -93,7 +93,7 @@ describe('String.Format Number Pattern', () => {
93
93
expect ( result ) . to . equal ( expectedValue ) ;
94
94
result = String . format ( template , valueToInsert , secondValueToInsert ) ;
95
95
expect ( result ) . to . equal ( expectedValue ) ;
96
- result = format ( template , valueToInsert , secondValueToInsert ) ;
96
+ result = formatString ( template , valueToInsert , secondValueToInsert ) ;
97
97
expect ( result ) . to . equal ( expectedValue ) ;
98
98
} ) ;
99
99
} ) ;
@@ -110,7 +110,7 @@ describe('String.Format Number Pattern', () => {
110
110
result = String . format ( template , valueToInsert ) ;
111
111
console . log ( result ) ;
112
112
expect ( result ) . to . equal ( expectedValue ) ;
113
- result = format ( template , valueToInsert ) ;
113
+ result = formatString ( template , valueToInsert ) ;
114
114
console . log ( result ) ;
115
115
expect ( result ) . to . equal ( expectedValue ) ;
116
116
} ) ;
@@ -126,7 +126,7 @@ describe('String.Format Number Pattern', () => {
126
126
result = String . format ( template , valueToInsert ) ;
127
127
console . log ( result ) ;
128
128
expect ( result ) . to . equal ( expectedValue ) ;
129
- result = format ( template , valueToInsert ) ;
129
+ result = formatString ( template , valueToInsert ) ;
130
130
console . log ( result ) ;
131
131
expect ( result ) . to . equal ( expectedValue ) ;
132
132
} ) ;
@@ -142,7 +142,7 @@ describe('String.Format Number Pattern', () => {
142
142
result = String . format ( template , valueToInsert ) ;
143
143
console . log ( result ) ;
144
144
expect ( result ) . to . equal ( expectedValue ) ;
145
- result = format ( template , valueToInsert ) ;
145
+ result = formatString ( template , valueToInsert ) ;
146
146
console . log ( result ) ;
147
147
expect ( result ) . to . equal ( expectedValue ) ;
148
148
} ) ;
@@ -158,7 +158,7 @@ describe('String.Format Number Pattern', () => {
158
158
result = String . format ( template , valueToInsert ) ;
159
159
console . log ( result ) ;
160
160
expect ( result ) . to . equal ( expectedValue ) ;
161
- result = format ( template , valueToInsert ) ;
161
+ result = formatString ( template , valueToInsert ) ;
162
162
console . log ( result ) ;
163
163
expect ( result ) . to . equal ( expectedValue ) ;
164
164
} ) ;
@@ -174,7 +174,7 @@ describe('String.Format Number Pattern', () => {
174
174
result = String . format ( template , valueToInsert ) ;
175
175
console . log ( result ) ;
176
176
expect ( result ) . to . equal ( expectedValue ) ;
177
- result = format ( template , valueToInsert ) ;
177
+ result = formatString ( template , valueToInsert ) ;
178
178
console . log ( result ) ;
179
179
expect ( result ) . to . equal ( expectedValue ) ;
180
180
} ) ;
@@ -190,7 +190,7 @@ describe('String.Format Number Pattern', () => {
190
190
expect ( actual ) . to . equal ( expectedValue ) ;
191
191
actual = String . format ( template , valueToInsert ) ;
192
192
expect ( actual ) . to . equal ( expectedValue ) ;
193
- actual = format ( template , valueToInsert ) ;
193
+ actual = formatString ( template , valueToInsert ) ;
194
194
expect ( actual ) . to . equal ( expectedValue ) ;
195
195
} ) ;
196
196
@@ -203,7 +203,7 @@ describe('String.Format Number Pattern', () => {
203
203
expect ( actual ) . to . equal ( expectedValue ) ;
204
204
actual = String . format ( template , valueToInsert ) ;
205
205
expect ( actual ) . to . equal ( expectedValue ) ;
206
- actual = format ( template , valueToInsert ) ;
206
+ actual = formatString ( template , valueToInsert ) ;
207
207
expect ( actual ) . to . equal ( expectedValue ) ;
208
208
} ) ;
209
209
} ) ;
@@ -216,7 +216,7 @@ describe('String.Format Number Pattern', () => {
216
216
expect ( result ) . to . equal ( '5' ) ;
217
217
result = String . format ( template , 5 ) ;
218
218
expect ( result ) . to . equal ( '5' ) ;
219
- result = format ( template , 5 ) ;
219
+ result = formatString ( template , 5 ) ;
220
220
expect ( result ) . to . equal ( '5' ) ;
221
221
} ) ;
222
222
@@ -226,7 +226,7 @@ describe('String.Format Number Pattern', () => {
226
226
expect ( result ) . to . equal ( '05' ) ;
227
227
result = String . format ( template , 5 ) ;
228
228
expect ( result ) . to . equal ( '05' ) ;
229
- result = format ( template , 5 ) ;
229
+ result = formatString ( template , 5 ) ;
230
230
expect ( result ) . to . equal ( '05' ) ;
231
231
} ) ;
232
232
@@ -236,7 +236,7 @@ describe('String.Format Number Pattern', () => {
236
236
expect ( result ) . to . equal ( '005' ) ;
237
237
result = String . format ( template , 5 ) ;
238
238
expect ( result ) . to . equal ( '005' ) ;
239
- result = format ( template , 5 ) ;
239
+ result = formatString ( template , 5 ) ;
240
240
expect ( result ) . to . equal ( '005' ) ;
241
241
} ) ;
242
242
@@ -246,7 +246,7 @@ describe('String.Format Number Pattern', () => {
246
246
expect ( result ) . to . equal ( '50000' ) ;
247
247
result = String . format ( template , 50000 ) ;
248
248
expect ( result ) . to . equal ( '50000' ) ;
249
- result = format ( template , 50000 ) ;
249
+ result = formatString ( template , 50000 ) ;
250
250
expect ( result ) . to . equal ( '50000' ) ;
251
251
} ) ;
252
252
@@ -259,7 +259,7 @@ describe('String.Format Number Pattern', () => {
259
259
expect ( result ) . to . equal ( expectedValue ) ;
260
260
result = String . format ( template , valueToInsert ) ;
261
261
expect ( result ) . to . equal ( expectedValue ) ;
262
- result = format ( template , valueToInsert ) ;
262
+ result = formatString ( template , valueToInsert ) ;
263
263
expect ( result ) . to . equal ( expectedValue ) ;
264
264
} ) ;
265
265
it ( 'should set the correct thousands seperator keeping the decimals' , ( ) => {
@@ -271,7 +271,7 @@ describe('String.Format Number Pattern', () => {
271
271
expect ( result ) . to . equal ( expectedValue ) ;
272
272
result = String . format ( template , valueToInsert ) ;
273
273
expect ( result ) . to . equal ( expectedValue ) ;
274
- result = format ( template , valueToInsert ) ;
274
+ result = formatString ( template , valueToInsert ) ;
275
275
expect ( result ) . to . equal ( expectedValue ) ;
276
276
} ) ;
277
277
} ) ;
@@ -282,7 +282,7 @@ describe('String.Format Number Pattern', () => {
282
282
expect ( result ) . to . equal ( '1f4' ) ;
283
283
result = String . format ( '{0:x}' , 500 ) ;
284
284
expect ( result ) . to . equal ( '1f4' ) ;
285
- result = format ( '{0:x}' , 500 ) ;
285
+ result = formatString ( '{0:x}' , 500 ) ;
286
286
expect ( result ) . to . equal ( '1f4' ) ;
287
287
} ) ;
288
288
@@ -291,7 +291,7 @@ describe('String.Format Number Pattern', () => {
291
291
expect ( result ) . to . equal ( '1F4' ) ;
292
292
result = String . format ( '{0:X}' , 500 ) ;
293
293
expect ( result ) . to . equal ( '1F4' ) ;
294
- result = format ( '{0:X}' , 500 ) ;
294
+ result = formatString ( '{0:X}' , 500 ) ;
295
295
expect ( result ) . to . equal ( '1F4' ) ;
296
296
} ) ;
297
297
@@ -300,7 +300,7 @@ describe('String.Format Number Pattern', () => {
300
300
expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
301
301
result = String . format ( '{0:x}' , 321.124 ) ;
302
302
expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
303
- result = format ( '{0:x}' , 321.124 ) ;
303
+ result = formatString ( '{0:x}' , 321.124 ) ;
304
304
expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
305
305
} ) ;
306
306
@@ -309,7 +309,7 @@ describe('String.Format Number Pattern', () => {
309
309
expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
310
310
result = String . format ( '{0:X}' , 321.124 ) ;
311
311
expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
312
- result = format ( '{0:X}' , 321.124 ) ;
312
+ result = formatString ( '{0:X}' , 321.124 ) ;
313
313
expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
314
314
} ) ;
315
315
@@ -318,7 +318,7 @@ describe('String.Format Number Pattern', () => {
318
318
expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
319
319
result = String . format ( '{0:x}' , - 321.124 ) ;
320
320
expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
321
- result = format ( '{0:x}' , - 321.124 ) ;
321
+ result = formatString ( '{0:x}' , - 321.124 ) ;
322
322
expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
323
323
} ) ;
324
324
@@ -327,7 +327,7 @@ describe('String.Format Number Pattern', () => {
327
327
expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
328
328
result = String . format ( '{0:X}' , - 321.124 ) ;
329
329
expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
330
- result = format ( '{0:X}' , - 321.124 ) ;
330
+ result = formatString ( '{0:X}' , - 321.124 ) ;
331
331
expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
332
332
} ) ;
333
333
} ) ;
@@ -347,7 +347,7 @@ describe('String.Format Text Pattern', () => {
347
347
expect ( formatted ) . to . equal ( 'the apple is red' ) ;
348
348
formatted = String . format ( 'the {type} is {color}' , fruit ) ;
349
349
expect ( formatted ) . to . equal ( 'the apple is red' ) ;
350
- formatted = format ( 'the {type} is {color}' , fruit ) ;
350
+ formatted = formatString ( 'the {type} is {color}' , fruit ) ;
351
351
expect ( formatted ) . to . equal ( 'the apple is red' ) ;
352
352
} ) ;
353
353
@@ -361,7 +361,7 @@ describe('String.Format Text Pattern', () => {
361
361
expect ( formatted ) . to . equal ( 'the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000' ) ;
362
362
formatted = String . format ( 'the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}' , fruit ) ;
363
363
expect ( formatted ) . to . equal ( 'the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000' ) ;
364
- formatted = format ( 'the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}' , fruit ) ;
364
+ formatted = formatString ( 'the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}' , fruit ) ;
365
365
expect ( formatted ) . to . equal ( 'the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000' ) ;
366
366
} ) ;
367
367
} ) ;
@@ -375,7 +375,7 @@ describe('String.Join', () => {
375
375
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
376
376
result = String . join ( '; ' , stringOne , stringTwo , stringThree ) ;
377
377
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
378
- result = join ( '; ' , stringOne , stringTwo , stringThree ) ;
378
+ result = joinString ( '; ' , stringOne , stringTwo , stringThree ) ;
379
379
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
380
380
} ) ;
381
381
@@ -385,7 +385,7 @@ describe('String.Join', () => {
385
385
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
386
386
result = String . join ( '; ' , object ) ;
387
387
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
388
- result = join ( '; ' , object ) ;
388
+ result = joinString ( '; ' , object ) ;
389
389
expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
390
390
} ) ;
391
391
@@ -398,7 +398,7 @@ describe('String.Join', () => {
398
398
result = String . join ( '.' , object ) ;
399
399
console . log ( result ) ;
400
400
expect ( result ) . to . equal ( 'Foo.Bar' ) ;
401
- result = join ( '.' , object ) ;
401
+ result = joinString ( '.' , object ) ;
402
402
console . log ( result ) ;
403
403
expect ( result ) . to . equal ( 'Foo.Bar' ) ;
404
404
} ) ;
@@ -415,7 +415,7 @@ describe('StringBuilder initialization', () => {
415
415
} ) ;
416
416
417
417
it ( 'should add a string if there is ctor parameter' , ( ) => {
418
- const builder = new StringBuilder ( format ( 'First {0}... ' , 'Part' ) ) ;
418
+ const builder = new StringBuilder ( formatString ( 'First {0}... ' , 'Part' ) ) ;
419
419
builder . AppendFormat ( 'Second {0}...' , 'Part' ) ;
420
420
421
421
console . log ( builder . ToString ( ) ) ;
0 commit comments