Skip to content

Commit 20587fa

Browse files
03-string>03-truncate
1 parent b161b30 commit 20587fa

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

1-js/05-data-types/03-string/3-truncate/_js.view/test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
describe("truncate", function() {
2-
it("truncate the long string to the given length (including the ellipsis)", function() {
2+
it("obcina ciąg do podanej długości (łącznie z wielokropkiem)", function() {
33
assert.equal(
4-
truncate("What I'd like to tell on this topic is:", 20),
5-
"What I'd like to te…"
4+
truncate("Oto, co chciałbym powiedzieć na ten temat:", 20),
5+
"Oto, co chciałbym p…"
66
);
77
});
88

9-
it("doesn't change short strings", function() {
9+
it("nie zmienia krótkich łańcuchów", function() {
1010
assert.equal(
11-
truncate("Hi everyone!", 20),
12-
"Hi everyone!"
11+
truncate("Cześć wszystkim!", 20),
12+
"Cześć wszystkim!"
1313
);
1414
});
1515

1-js/05-data-types/03-string/3-truncate/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The maximal length must be `maxlength`, so we need to cut it a little shorter, to give space for the ellipsis.
1+
Zwracany ciąg nie może być dłuższy niż `maxlength`, więc jeśli go skrócimy, to musimy usunąć o jeden znak mniej, aby zrobić miejsce na wielokropek.
22

3-
Note that there is actually a single unicode character for an ellipsis. That's not three dots.
3+
Należy pamiętać, że wielokropek to '…' – dokładnie jeden znak specjalny Unicode. To nie to samo, co '. . .' – trzy kropki.
44

55
```js run demo
66
function truncate(str, maxlength) {

1-js/05-data-types/03-string/3-truncate/task.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ importance: 5
22

33
---
44

5-
# Truncate the text
5+
# Obcinanie tekstu
66

7-
Create a function `truncate(str, maxlength)` that checks the length of the `str` and, if it exceeds `maxlength` -- replaces the end of `str` with the ellipsis character `"…"`, to make its length equal to `maxlength`.
7+
Utwórz funkcję `truncate(str, maxlength)`, która sprawdza długość łańcucha `str` i jeśli przekracza `maxlength`, zamienia koniec `str` na ``, tak aby jego długość była równa `maxlength`.
88

9-
The result of the function should be the truncated (if needed) string.
9+
Wynik funkcji musi być tym samym ciągiem, jeśli obcięcie nie jest wymagane lub obciętym ciągiem, jeśli to konieczne.
1010

11-
For instance:
11+
Na przykład:
1212

1313
```js
14-
truncate("What I'd like to tell on this topic is:", 20) = "What I'd like to te"
14+
truncate("Oto, co chciałbym powiedzieć na ten temat:", 20) = "Oto, co chciałbym p"
1515

16-
truncate("Hi everyone!", 20) = "Hi everyone!"
16+
truncate("Cześć wszystkim!", 20) = "Cześć wszystkim!"
1717
```

0 commit comments

Comments
 (0)