string - Last Instance of Character -
I want to find the last example of a character in a string. Looking at Swift deals differently with the strings (ranges), I was hoping someone has not been able to figure out the best way to deal with this as it has ended before.
The paragraph string I was parallel was "like". Let me know the last "_" and the last "." There is a need to parse the section between the number 380 so that each link has been formatted in such a manner, but the substrings functioning for Swift is still a bit foreign to me, with the inclusion of different byte lengths.
Thanks in advance!
"text" itemprop = "text">
// expression to find the last middle-string "_" and "previous". " SourceStr = "abc_defg_hijk_lmn.xyz" go regex = go to NSRegularExpression (pattern: "_ ([^ _] *) \\ [^ \\.] * $.", Option: zero, error: zero); If going to matchResult = regex .firstMatchInString? (SourceStr, option: zero, limit: NSMakeRange (0, countElements (sourceStr)) {go matchingRange = matchingResult.rangeAtIndex (1) go matchingString = (SourceStr as NSString) .substringWithRange (matchRange)} < / Pre>
Comments
Post a Comment