Skip to content

Commit

Permalink
use prefix func to get a substring
Browse files Browse the repository at this point in the history
  • Loading branch information
choykarl committed Jan 1, 2024
1 parent 2df0891 commit d746ae3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Ali/AliService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AliService: QueryService {

override func translate(_ text: String, from: Language, to: Language, completion: @escaping (EZQueryResult, Error?) -> Void) {
let limit = 5000
let text = text.count > limit ? String(text[..<text.index(text.startIndex, offsetBy: limit)]) : text
let text = String(text.prefix(limit))

let transType = AliTranslateType.transType(from: from, to: to)
guard transType != .unsupported else {
Expand Down

0 comments on commit d746ae3

Please sign in to comment.