Coverage for mypackage / failerror.py: 85%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2025-12-21 13:48 +0900

1# -*- coding: utf-8 -*- 

2 

3def substring(target: str, beginIndex: int, endIndex: int = None): 

4 ''' 

5  

6 開始、終了インデックスを指定して部分文字列を取得します。 

7  

8 Args: 

9 target (str): 入力文字列 

10 beginIndex (int): 部分文字列の開始インデックスを指定します。 

11 部分文字列はこのインデックスから開始します。 

12 endIndex (int) 部分文字列の終了インデックスを指定します。部分文字列は 

13 このインデックスの1つ前の文字で終了します。このパラメータを省略した 

14 場合は、部分文字列は開始インデックスから文字列の最後までになります。 

15  

16 Returns: 

17 str: 取得した部分文字列を返します。 

18  

19 ''' 

20 ret:str = '' 

21 if endIndex == None: 21 ↛ 22line 21 didn't jump to line 22 because the condition on line 21 was never true

22 endIndex = len(target) 

23 

24 i = 0 

25 while i <= endIndex: 

26 ret = ret + target[i] 

27 i += 1 

28 

29 return ret