Swift에서 replace는 어떻게 하나 하면서 찾아본...

역시나 있다...


그것도 아주 이쁘게..


You can use this:

let s = "This is my string"
let modified = s.replace(" ", withString:"+")    

If you add this extension method anywhere in your code:

extension String
{
    func replace(target: String, withString: String) -> String
    {
       return self.stringByReplacingOccurrencesOfString(target, withString: withString, options: NSStringCompareOptions.LiteralSearch, range: nil)
    }
}

Swift 3:

extension String
{
    func replace(target: String, withString: String) -> String
    {
        return self.replacingOccurrences(of: target, with: withString, options: NSString.CompareOptions.literal, range: nil)
    }
}


실제 링크는 여기

http://stackoverflow.com/questions/24200888/any-way-to-replace-characters-on-swift-string


Swift2


Swift3



Kanna가 css을 지원한다는데

사실 문법을 잘 모르겠다 -_-;


그래서 좀 검색 해보니


튜토리얼이 있다.

http://tid-kijyun.github.io/Kanna/tutorials/v2/searching.html


그리고 구글을 통해 찾은 샘플 ? 이랄까...

이건 Alamofire랑 같이 해서 사용 하는 방법...

https://www.twilio.com/blog/2016/08/web-scraping-and-parsing-html-in-swift-with-kanna-and-alamofire.html


여기서 힌트를 얻고 하니 잘 된다...

문제가 되엇던 부분은...


이런식의 코드랄까 ? 특수기호를 위해선...저렇게....

for show in doc.css("td[id^='Text']") {

어플리케이션 초기 실행 시


어플리케이션 사용에 도움말을 Coach Mark라고 한단다.

XCode 사용시 패키기 관리를 해주는 패키지 매니저


Alcatraz


공식 사이트 http://alcatraz.io/

나중에 좀 써보고 좋은 거 찾아 봐야 할 듯

에러 때문에 찾은 거긴 하지만 매번 시뮬레이터의 지역을 켜기 귀찮았는데 아래 방법이 있다.

  • Product -> Scheme -> Edit Scheme -> Options -> Allow Location Simulation must be checked and try providing a default location, don't leave it set to "none"


http://stackoverflow.com/questions/32543754/ios-9-error-domain-kclerrordomain-code-0-null


+ Recent posts