Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 23b09c0

Browse files
authored
replaced deprecated substring (#395)
* replaced deprecated substring * replaced it in example notebook * minor changes * corrected * replaced substring in notebook * Revert "replaced substring in notebook" This reverts commit c698e54. * changed only single cell * changed only single cell * updated * updated * replaced with dropLast
1 parent e11ab67 commit 23b09c0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Datasets/TextUnsupervised/TextUnsupervised.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ public struct TextUnsupervised {
129129
var rows = rawText.components(separatedBy: "\"\n\"")
130130
// Removing the initial '"'.
131131
rows[0] = String(rows[0].dropFirst())
132-
// Removing the last '"\n'.
133-
rows[rows.count - 1] = String(
134-
rows[rows.count - 1].substring(to: rows[rows.count - 1].index(rows[rows.count - 1].endIndex, offsetBy: -2)))
132+
// Removing the last '"\n'
133+
rows[rows.indices.last!] = String(rows.last!.dropLast(2))
135134
return rows
136135
}
137136

Examples/Notebooks/LanguageModel.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
" //Removing the initial \"\n",
128128
" rows[0] = String(rows[0].dropFirst())\n",
129129
" //Removing the last \"\\n\n",
130-
" rows[rows.count-1] = String(rows[rows.count-1].substring(to: rows[rows.count-1].count-2))\n",
130+
" rows[rows.indices.last!] = String(rows.last!.dropLast(2))\n",
131131
" return rows\n",
132132
"}"
133133
]

0 commit comments

Comments
 (0)