1- import { String , StringBuilder , isNullOrWhiteSpace , format , join } from '..' ;
1+ import { String , StringBuilder , isNullOrWhiteSpace , formatString , joinString } from '..' ;
22import { Fruit } from './fruit' ;
33import { expect } from 'chai' ;
44import 'mocha' ;
@@ -57,7 +57,7 @@ describe('String.Format Number Pattern', () => {
5757 expect ( result ) . to . equal ( template ) ;
5858 result = String . format ( template , valueToInsert ) ;
5959 expect ( result ) . to . equal ( template ) ;
60- result = format ( template , valueToInsert ) ;
60+ result = formatString ( template , valueToInsert ) ;
6161 expect ( result ) . to . equal ( template ) ;
6262 } ) ;
6363
@@ -68,7 +68,7 @@ describe('String.Format Number Pattern', () => {
6868 expect ( result ) . to . equal ( valueToInsert ) ;
6969 result = String . format ( template , valueToInsert ) ;
7070 expect ( result ) . to . equal ( valueToInsert ) ;
71- result = format ( template , valueToInsert ) ;
71+ result = formatString ( template , valueToInsert ) ;
7272 expect ( result ) . to . equal ( valueToInsert ) ;
7373 } ) ;
7474
@@ -80,7 +80,7 @@ describe('String.Format Number Pattern', () => {
8080 expect ( result ) . to . equal ( expectedValue ) ;
8181 result = String . format ( template , valueToInsert ) ;
8282 expect ( result ) . to . equal ( expectedValue ) ;
83- result = format ( template , valueToInsert ) ;
83+ result = formatString ( template , valueToInsert ) ;
8484 expect ( result ) . to . equal ( expectedValue ) ;
8585 } ) ;
8686
@@ -93,7 +93,7 @@ describe('String.Format Number Pattern', () => {
9393 expect ( result ) . to . equal ( expectedValue ) ;
9494 result = String . format ( template , valueToInsert , secondValueToInsert ) ;
9595 expect ( result ) . to . equal ( expectedValue ) ;
96- result = format ( template , valueToInsert , secondValueToInsert ) ;
96+ result = formatString ( template , valueToInsert , secondValueToInsert ) ;
9797 expect ( result ) . to . equal ( expectedValue ) ;
9898 } ) ;
9999 } ) ;
@@ -110,7 +110,7 @@ describe('String.Format Number Pattern', () => {
110110 result = String . format ( template , valueToInsert ) ;
111111 console . log ( result ) ;
112112 expect ( result ) . to . equal ( expectedValue ) ;
113- result = format ( template , valueToInsert ) ;
113+ result = formatString ( template , valueToInsert ) ;
114114 console . log ( result ) ;
115115 expect ( result ) . to . equal ( expectedValue ) ;
116116 } ) ;
@@ -126,7 +126,7 @@ describe('String.Format Number Pattern', () => {
126126 result = String . format ( template , valueToInsert ) ;
127127 console . log ( result ) ;
128128 expect ( result ) . to . equal ( expectedValue ) ;
129- result = format ( template , valueToInsert ) ;
129+ result = formatString ( template , valueToInsert ) ;
130130 console . log ( result ) ;
131131 expect ( result ) . to . equal ( expectedValue ) ;
132132 } ) ;
@@ -142,7 +142,7 @@ describe('String.Format Number Pattern', () => {
142142 result = String . format ( template , valueToInsert ) ;
143143 console . log ( result ) ;
144144 expect ( result ) . to . equal ( expectedValue ) ;
145- result = format ( template , valueToInsert ) ;
145+ result = formatString ( template , valueToInsert ) ;
146146 console . log ( result ) ;
147147 expect ( result ) . to . equal ( expectedValue ) ;
148148 } ) ;
@@ -158,7 +158,7 @@ describe('String.Format Number Pattern', () => {
158158 result = String . format ( template , valueToInsert ) ;
159159 console . log ( result ) ;
160160 expect ( result ) . to . equal ( expectedValue ) ;
161- result = format ( template , valueToInsert ) ;
161+ result = formatString ( template , valueToInsert ) ;
162162 console . log ( result ) ;
163163 expect ( result ) . to . equal ( expectedValue ) ;
164164 } ) ;
@@ -174,7 +174,7 @@ describe('String.Format Number Pattern', () => {
174174 result = String . format ( template , valueToInsert ) ;
175175 console . log ( result ) ;
176176 expect ( result ) . to . equal ( expectedValue ) ;
177- result = format ( template , valueToInsert ) ;
177+ result = formatString ( template , valueToInsert ) ;
178178 console . log ( result ) ;
179179 expect ( result ) . to . equal ( expectedValue ) ;
180180 } ) ;
@@ -190,7 +190,7 @@ describe('String.Format Number Pattern', () => {
190190 expect ( actual ) . to . equal ( expectedValue ) ;
191191 actual = String . format ( template , valueToInsert ) ;
192192 expect ( actual ) . to . equal ( expectedValue ) ;
193- actual = format ( template , valueToInsert ) ;
193+ actual = formatString ( template , valueToInsert ) ;
194194 expect ( actual ) . to . equal ( expectedValue ) ;
195195 } ) ;
196196
@@ -203,7 +203,7 @@ describe('String.Format Number Pattern', () => {
203203 expect ( actual ) . to . equal ( expectedValue ) ;
204204 actual = String . format ( template , valueToInsert ) ;
205205 expect ( actual ) . to . equal ( expectedValue ) ;
206- actual = format ( template , valueToInsert ) ;
206+ actual = formatString ( template , valueToInsert ) ;
207207 expect ( actual ) . to . equal ( expectedValue ) ;
208208 } ) ;
209209 } ) ;
@@ -216,7 +216,7 @@ describe('String.Format Number Pattern', () => {
216216 expect ( result ) . to . equal ( '5' ) ;
217217 result = String . format ( template , 5 ) ;
218218 expect ( result ) . to . equal ( '5' ) ;
219- result = format ( template , 5 ) ;
219+ result = formatString ( template , 5 ) ;
220220 expect ( result ) . to . equal ( '5' ) ;
221221 } ) ;
222222
@@ -226,7 +226,7 @@ describe('String.Format Number Pattern', () => {
226226 expect ( result ) . to . equal ( '05' ) ;
227227 result = String . format ( template , 5 ) ;
228228 expect ( result ) . to . equal ( '05' ) ;
229- result = format ( template , 5 ) ;
229+ result = formatString ( template , 5 ) ;
230230 expect ( result ) . to . equal ( '05' ) ;
231231 } ) ;
232232
@@ -236,7 +236,7 @@ describe('String.Format Number Pattern', () => {
236236 expect ( result ) . to . equal ( '005' ) ;
237237 result = String . format ( template , 5 ) ;
238238 expect ( result ) . to . equal ( '005' ) ;
239- result = format ( template , 5 ) ;
239+ result = formatString ( template , 5 ) ;
240240 expect ( result ) . to . equal ( '005' ) ;
241241 } ) ;
242242
@@ -246,7 +246,7 @@ describe('String.Format Number Pattern', () => {
246246 expect ( result ) . to . equal ( '50000' ) ;
247247 result = String . format ( template , 50000 ) ;
248248 expect ( result ) . to . equal ( '50000' ) ;
249- result = format ( template , 50000 ) ;
249+ result = formatString ( template , 50000 ) ;
250250 expect ( result ) . to . equal ( '50000' ) ;
251251 } ) ;
252252
@@ -259,7 +259,7 @@ describe('String.Format Number Pattern', () => {
259259 expect ( result ) . to . equal ( expectedValue ) ;
260260 result = String . format ( template , valueToInsert ) ;
261261 expect ( result ) . to . equal ( expectedValue ) ;
262- result = format ( template , valueToInsert ) ;
262+ result = formatString ( template , valueToInsert ) ;
263263 expect ( result ) . to . equal ( expectedValue ) ;
264264 } ) ;
265265 it ( 'should set the correct thousands seperator keeping the decimals' , ( ) => {
@@ -271,7 +271,7 @@ describe('String.Format Number Pattern', () => {
271271 expect ( result ) . to . equal ( expectedValue ) ;
272272 result = String . format ( template , valueToInsert ) ;
273273 expect ( result ) . to . equal ( expectedValue ) ;
274- result = format ( template , valueToInsert ) ;
274+ result = formatString ( template , valueToInsert ) ;
275275 expect ( result ) . to . equal ( expectedValue ) ;
276276 } ) ;
277277 } ) ;
@@ -282,7 +282,7 @@ describe('String.Format Number Pattern', () => {
282282 expect ( result ) . to . equal ( '1f4' ) ;
283283 result = String . format ( '{0:x}' , 500 ) ;
284284 expect ( result ) . to . equal ( '1f4' ) ;
285- result = format ( '{0:x}' , 500 ) ;
285+ result = formatString ( '{0:x}' , 500 ) ;
286286 expect ( result ) . to . equal ( '1f4' ) ;
287287 } ) ;
288288
@@ -291,7 +291,7 @@ describe('String.Format Number Pattern', () => {
291291 expect ( result ) . to . equal ( '1F4' ) ;
292292 result = String . format ( '{0:X}' , 500 ) ;
293293 expect ( result ) . to . equal ( '1F4' ) ;
294- result = format ( '{0:X}' , 500 ) ;
294+ result = formatString ( '{0:X}' , 500 ) ;
295295 expect ( result ) . to . equal ( '1F4' ) ;
296296 } ) ;
297297
@@ -300,7 +300,7 @@ describe('String.Format Number Pattern', () => {
300300 expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
301301 result = String . format ( '{0:x}' , 321.124 ) ;
302302 expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
303- result = format ( '{0:x}' , 321.124 ) ;
303+ result = formatString ( '{0:x}' , 321.124 ) ;
304304 expect ( result ) . to . equal ( '141.1fbe76c8b44' ) ;
305305 } ) ;
306306
@@ -309,7 +309,7 @@ describe('String.Format Number Pattern', () => {
309309 expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
310310 result = String . format ( '{0:X}' , 321.124 ) ;
311311 expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
312- result = format ( '{0:X}' , 321.124 ) ;
312+ result = formatString ( '{0:X}' , 321.124 ) ;
313313 expect ( result ) . to . equal ( '141.1FBE76C8B44' ) ;
314314 } ) ;
315315
@@ -318,7 +318,7 @@ describe('String.Format Number Pattern', () => {
318318 expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
319319 result = String . format ( '{0:x}' , - 321.124 ) ;
320320 expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
321- result = format ( '{0:x}' , - 321.124 ) ;
321+ result = formatString ( '{0:x}' , - 321.124 ) ;
322322 expect ( result ) . to . equal ( '-141.1fbe76c8b44' ) ;
323323 } ) ;
324324
@@ -327,7 +327,7 @@ describe('String.Format Number Pattern', () => {
327327 expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
328328 result = String . format ( '{0:X}' , - 321.124 ) ;
329329 expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
330- result = format ( '{0:X}' , - 321.124 ) ;
330+ result = formatString ( '{0:X}' , - 321.124 ) ;
331331 expect ( result ) . to . equal ( '-141.1FBE76C8B44' ) ;
332332 } ) ;
333333 } ) ;
@@ -347,7 +347,7 @@ describe('String.Format Text Pattern', () => {
347347 expect ( formatted ) . to . equal ( 'the apple is red' ) ;
348348 formatted = String . format ( 'the {type} is {color}' , fruit ) ;
349349 expect ( formatted ) . to . equal ( 'the apple is red' ) ;
350- formatted = format ( 'the {type} is {color}' , fruit ) ;
350+ formatted = formatString ( 'the {type} is {color}' , fruit ) ;
351351 expect ( formatted ) . to . equal ( 'the apple is red' ) ;
352352 } ) ;
353353
@@ -361,7 +361,7 @@ describe('String.Format Text Pattern', () => {
361361 expect ( formatted ) . to . equal ( 'the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000' ) ;
362362 formatted = String . format ( 'the {type:U} is {color:L} shipped on {shippingDate:s} with an amount of {amount:n}' , fruit ) ;
363363 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 ) ;
365365 expect ( formatted ) . to . equal ( 'the APPLE is red shipped on 2018-12-31T01:02:03 with an amount of 10.000' ) ;
366366 } ) ;
367367 } ) ;
@@ -375,7 +375,7 @@ describe('String.Join', () => {
375375 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
376376 result = String . join ( '; ' , stringOne , stringTwo , stringThree ) ;
377377 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
378- result = join ( '; ' , stringOne , stringTwo , stringThree ) ;
378+ result = joinString ( '; ' , stringOne , stringTwo , stringThree ) ;
379379 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
380380 } ) ;
381381
@@ -385,7 +385,7 @@ describe('String.Join', () => {
385385 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
386386 result = String . join ( '; ' , object ) ;
387387 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
388- result = join ( '; ' , object ) ;
388+ result = joinString ( '; ' , object ) ;
389389 expect ( result ) . to . equal ( 'red; yellow; blue' ) ;
390390 } ) ;
391391
@@ -398,7 +398,7 @@ describe('String.Join', () => {
398398 result = String . join ( '.' , object ) ;
399399 console . log ( result ) ;
400400 expect ( result ) . to . equal ( 'Foo.Bar' ) ;
401- result = join ( '.' , object ) ;
401+ result = joinString ( '.' , object ) ;
402402 console . log ( result ) ;
403403 expect ( result ) . to . equal ( 'Foo.Bar' ) ;
404404 } ) ;
@@ -415,7 +415,7 @@ describe('StringBuilder initialization', () => {
415415 } ) ;
416416
417417 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' ) ) ;
419419 builder . AppendFormat ( 'Second {0}...' , 'Part' ) ;
420420
421421 console . log ( builder . ToString ( ) ) ;
0 commit comments