Skip to content

Commit

Permalink
Fix scanUpToString returning nil on Linux
Browse files Browse the repository at this point in the history
Behavior of scanUpToString differs from scanUpToString(into:).
The former returns nil when argument is "", the latter returns rest of the string.
  • Loading branch information
zmeyc committed Aug 11, 2021
1 parent 0905e3b commit c60808d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/TelegramBotSDK/Extensions/Scanner+Compatibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ extension Scanner {

#if os(Linux) || os(Windows)
func scanUpTo(_ string: String) -> String? {
if string.isEmpty {
return scanUpToCharacters(from: CharacterSet())
}
return scanUpToString(string)
}
#elseif os(OSX)
Expand Down

0 comments on commit c60808d

Please sign in to comment.