@@ -226,6 +226,9 @@ def substring(string: Optional[str], start: Optional[float], length: Optional[fl
226
226
if string is None :
227
227
return None
228
228
229
+ if string is utils .Utils .NULL_VALUE :
230
+ raise jexception .JException ("T0410" , - 1 )
231
+
229
232
start = int (start ) if start is not None else None
230
233
length = int (length ) if length is not None else None
231
234
@@ -307,6 +310,9 @@ def substring_before(string: Optional[str], chars: Optional[str]) -> Optional[st
307
310
if string is None :
308
311
return None
309
312
313
+ if string is utils .Utils .NULL_VALUE :
314
+ raise jexception .JException ("T0410" , - 1 )
315
+
310
316
if chars is None :
311
317
return string
312
318
@@ -328,6 +334,9 @@ def substring_after(string: Optional[str], chars: Optional[str]) -> Optional[str
328
334
if string is None :
329
335
return None
330
336
337
+ if string is utils .Utils .NULL_VALUE :
338
+ raise jexception .JException ("T0410" , - 1 )
339
+
331
340
pos = string .find (chars )
332
341
if pos > - 1 :
333
342
return string [pos + len (chars ):]
@@ -345,6 +354,9 @@ def lowercase(string: Optional[str]) -> Optional[str]:
345
354
if string is None :
346
355
return None
347
356
357
+ if string is utils .Utils .NULL_VALUE :
358
+ raise jexception .JException ("T0410" , - 1 )
359
+
348
360
return string .casefold ()
349
361
350
362
#
@@ -358,6 +370,9 @@ def uppercase(string: Optional[str]) -> Optional[str]:
358
370
if string is None :
359
371
return None
360
372
373
+ if string is utils .Utils .NULL_VALUE :
374
+ raise jexception .JException ("T0410" , - 1 )
375
+
361
376
return string .upper ()
362
377
363
378
#
@@ -371,6 +386,9 @@ def length(string: Optional[str]) -> Optional[int]:
371
386
if string is None :
372
387
return None
373
388
389
+ if string is utils .Utils .NULL_VALUE :
390
+ raise jexception .JException ("T0410" , - 1 )
391
+
374
392
return len (string )
375
393
376
394
#
@@ -384,6 +402,9 @@ def trim(string: Optional[str]) -> Optional[str]:
384
402
if string is None :
385
403
return None
386
404
405
+ if string is utils .Utils .NULL_VALUE :
406
+ raise jexception .JException ("T0410" , - 1 )
407
+
387
408
if not string :
388
409
return ""
389
410
@@ -414,6 +435,9 @@ def pad(string: Optional[str], width: Optional[int], char: Optional[str]) -> Opt
414
435
if string is None :
415
436
return None
416
437
438
+ if string is utils .Utils .NULL_VALUE :
439
+ raise jexception .JException ("T0410" , - 1 )
440
+
417
441
if char is None or not char :
418
442
char = " "
419
443
@@ -428,6 +452,10 @@ def pad(string: Optional[str], width: Optional[int], char: Optional[str]) -> Opt
428
452
def left_pad (string : Optional [str ], size : Optional [int ], pad_str : Optional [str ]) -> Optional [str ]:
429
453
if string is None :
430
454
return None
455
+
456
+ if string is utils .Utils .NULL_VALUE :
457
+ raise jexception .JException ("T0410" , - 1 )
458
+
431
459
if pad_str is None :
432
460
pad_str = " "
433
461
@@ -451,6 +479,10 @@ def left_pad(string: Optional[str], size: Optional[int], pad_str: Optional[str])
451
479
def right_pad (string : Optional [str ], size : Optional [int ], pad_str : Optional [str ]) -> Optional [str ]:
452
480
if string is None :
453
481
return None
482
+
483
+ if string is utils .Utils .NULL_VALUE :
484
+ raise jexception .JException ("T0410" , - 1 )
485
+
454
486
if pad_str is None :
455
487
pad_str = " "
456
488
@@ -511,6 +543,9 @@ def contains(string: Optional[str], token: Union[None, str, re.Pattern]) -> Opti
511
543
if string is None :
512
544
return None
513
545
546
+ if string is utils .Utils .NULL_VALUE :
547
+ return None
548
+
514
549
result = False
515
550
516
551
if isinstance (token , str ):
@@ -539,6 +574,9 @@ def match_(string: Optional[str], regex: Optional[re.Pattern], limit: Optional[i
539
574
if string is None :
540
575
return None
541
576
577
+ if string is utils .Utils .NULL_VALUE :
578
+ raise jexception .JException ("T0410" , - 1 )
579
+
542
580
# limit, if specified, must be a non-negative number
543
581
if limit is not None and limit < 0 :
544
582
raise jexception .JException ("D3040" , - 1 , limit )
@@ -710,6 +748,10 @@ def safe_replace_first(s: Optional[str], pattern: re.Pattern, replacement: str)
710
748
def replace (string : Optional [str ], pattern : Union [str , re .Pattern ], replacement : Optional [Any ], limit : Optional [int ]) -> Optional [str ]:
711
749
if string is None :
712
750
return None
751
+
752
+ if string is utils .Utils .NULL_VALUE :
753
+ raise jexception .JException ("T0410" , - 1 )
754
+
713
755
if isinstance (pattern , str ):
714
756
if not pattern :
715
757
raise jexception .JException ("Second argument of replace function cannot be an empty string" , 0 )
@@ -740,6 +782,10 @@ def base64encode(string: Optional[str]) -> Optional[str]:
740
782
# undefined inputs always return undefined
741
783
if string is None :
742
784
return None
785
+
786
+ if string is utils .Utils .NULL_VALUE :
787
+ raise jexception .JException ("T0410" , - 1 )
788
+
743
789
try :
744
790
return base64 .b64encode (string .encode ("utf-8" )).decode ("utf-8" )
745
791
except Exception as e :
@@ -755,6 +801,10 @@ def base64decode(string: Optional[str]) -> Optional[str]:
755
801
# undefined inputs always return undefined
756
802
if string is None :
757
803
return None
804
+
805
+ if string is utils .Utils .NULL_VALUE :
806
+ raise jexception .JException ("T0410" , - 1 )
807
+
758
808
try :
759
809
return base64 .b64decode (string .encode ("utf-8" )).decode ("utf-8" )
760
810
except Exception as e :
@@ -771,6 +821,9 @@ def encode_url_component(string: Optional[str]) -> Optional[str]:
771
821
if string is None :
772
822
return None
773
823
824
+ if string is utils .Utils .NULL_VALUE :
825
+ raise jexception .JException ("T0410" , - 1 )
826
+
774
827
# See https://stackoverflow.com/questions/946170/equivalent-javascript-functions-for-pythons-urllib-parse-quote-and-urllib-par
775
828
return urllib .parse .quote (string , safe = "~()*!.'" )
776
829
@@ -785,6 +838,9 @@ def encode_url(string: Optional[str]) -> Optional[str]:
785
838
if string is None :
786
839
return None
787
840
841
+ if string is utils .Utils .NULL_VALUE :
842
+ raise jexception .JException ("T0410" , - 1 )
843
+
788
844
# See https://stackoverflow.com/questions/946170/equivalent-javascript-functions-for-pythons-urllib-parse-quote-and-urllib-par
789
845
return urllib .parse .quote (string , safe = "~@#$&()*!+=:;,.?/'" )
790
846
@@ -799,6 +855,9 @@ def decode_url_component(string: Optional[str]) -> Optional[str]:
799
855
if string is None :
800
856
return None
801
857
858
+ if string is utils .Utils .NULL_VALUE :
859
+ raise jexception .JException ("T0410" , - 1 )
860
+
802
861
# See https://stackoverflow.com/questions/946170/equivalent-javascript-functions-for-pythons-urllib-parse-quote-and-urllib-par
803
862
return urllib .parse .unquote (string , errors = "strict" )
804
863
@@ -813,6 +872,9 @@ def decode_url(string: Optional[str]) -> Optional[str]:
813
872
if string is None :
814
873
return None
815
874
875
+ if string is utils .Utils .NULL_VALUE :
876
+ raise jexception .JException ("T0410" , - 1 )
877
+
816
878
# See https://stackoverflow.com/questions/946170/equivalent-javascript-functions-for-pythons-urllib-parse-quote-and-urllib-par
817
879
return urllib .parse .unquote (string , errors = "strict" )
818
880
@@ -821,6 +883,9 @@ def split(string: Optional[str], pattern: Union[str, Optional[re.Pattern]], limi
821
883
if string is None :
822
884
return None
823
885
886
+ if string is utils .Utils .NULL_VALUE :
887
+ raise jexception .JException ("T0410" , - 1 )
888
+
824
889
if limit is not None and int (limit ) < 0 :
825
890
raise jexception .JException ("D3020" , - 1 , string )
826
891
0 commit comments