I am getting a string from html parse that is;
string = "javascript:getInfo(1,'Info/99/something', 'City Hall',1, 99);"
my code is something like
var startIndex = text.rangeOfString("'") var endIndex = text.rangeOfString("',") var range2 = startIndex2...endIndex substr= string.substringWithRange(range)
i am not sure if my second splitting string should be "'" or "',"
i want my outcome as
substr = "Info/99/something"
Sponsor sarunw.com and reach thousands of iOS developers. In Swift, you can check for string and character equality with the "equal to" operator ( ==) and "not equal to" operator ( != ). We use the same operator for Character. These "equal to" operator is suitable for simple string comparison where you required an exact match.
This would convey a message that you want to compare two strings ignoring their cases ( .caseInsensitive ). street.compare(alsoStreet, options: .caseInsensitive) == .orderedSame While this means the lowercase form of two strings should be equals.
While this means the lowercase form of two strings should be equals. Very different, right? I might be wrong about the meaning and assumption of the word "Straße" because I don't know German.
extension String { func slice(from: String, to: String) -> String? { return (range(of: from)?.upperBound).flatMap { substringFrom in (range(of: to, range: substringFrom..<endIndex)?.lowerBound).map { substringTo in String(self[substringFrom..<substringTo]) } } } } "javascript:getInfo(1,'Info/99/something', 'City Hall',1, 99);" .sliceFrom("'", to: "',")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With