( string_slice )
凡例
| → | 対応コードあり |
| → | 直接対応していないが代替の書き方あり |
| → | 対応コードなし |
| - | 未確認 |
| ( .. ) | ローカライズまだ |
| Example | Python pytest |
PHP PHPUnit |
Swift Testing |
Csharp xunit |
Bash bats |
Powershell pester |
C++ GoogleTest |
JavaScript Jest |
Kotlin jUnit |
|---|---|---|---|---|---|---|---|---|---|
| ( get_first_character ) | text[0] | - | - | - | - | - | - | - | - |
| ( get_nth_character ) | text[n] | - | - | - | - | - | - | - | - |
| ( get_last_character ) | text[-1] | - | - | - | - | - | - | - | - |
| ( slice_from_m_to_n ) | text[m:n+1] | substr($s, $m, $n - $m + 1) | - | - | - | - | s.substr(m, n - m + 1) | - | - |
| ( slice_from_m_to_end ) | text[m:] | substr($s, $m) | - | - | - | - | s.substr(m) | - | - |
| ( slice_from_m_with_length ) | text[m:m+length] | substr($s, $m, $length) | - | - | - | - | s.substr(m, length) | - | - |
| ( take_first_n ) | text[:n] | substr($s, 0, $n) | - | - | - | - | - | - | - |
| ( take_last_n ) | text[-n:] | substr($s, -$n) | - | - | - | - | s.substr(s.size() - n) | - | - |
| ( drop_first_n ) | text[n:] | substr($s, $n) | - | - | - | - | s.substr(n) | - | - |
| ( drop_last_n ) | text[:-n] | substr($s, 0, -$n) | - | - | - | - | s.substr(0, s.size() - n) | - | - |
| ( remove_suffix ) | removesuffix | not built-in | - | - | ${text%suffix} | - | - | - | - |
| ( remove_prefix ) | removeprefix | not built-in | - | - | ${text#prefix} | - | - | - | - |
| ( remove_nth_character ) | text[:n] + text[n+1:] | - | - | - | - | - | - | - | - |
| ( remove_range ) | text[:m] + text[n+1:] | - | - | - | - | - | - | - | - |
| ( replace_range ) | text[:m] + text + text[n+1:] | - | - | - | - | - | - | - | - |
| ( slice_out_of_range ) | does not raise | - | - | - | - | - | - | - | - |