Skip to content

truncateExpect

이 문자열은 끝 문자(endStringChar)까지 잘림을 무시합니다. 예상 길이에 도달하면, 끝 문자 뒤의 잘린 문자열을 반환합니다.

Parameters

이름타입필수기본값
strstring
expectLengthnumber
endStringCharnamedstring'.'

named 표시가 있는 파라미터는 Dart에서는 named 파라미터, Python에서는 키워드 인자로 전달됩니다.

Returns

string

Examples

javascript
truncateExpect('hello. this is test string.', 10, '.'); // Returns 'hello. this is test string.'
truncateExpect('hello-this-is-test-string-bye', 14, '-'); // Returns 'hello-this-is-'
dart
truncateExpect('hello. this is test string.', 10, endStringChar: '.'); // Returns 'hello. this is test string.'
truncateExpect('hello-this-is-test-string-bye', 14, endStringChar: '-'); // Returns 'hello-this-is-'
python
truncateExpect('hello. this is test string.', 10, '.')  # Returns 'hello. this is test string.'
truncateExpect('hello-this-is-test-string-bye', 14, '-')  # Returns 'hello-this-is-'

Released under the MIT License