cocoa

Create (sane/safe) filename from any (unsafe) string

Create (sane/safe) filename from any (unsafe) string Question: I want to create a sane/safe filename (i.e. somewhat readable, no "strange" characters, etc.) from some random Unicode string (which might contain just anything). (It doesn’t matter for me whether the function is Cocoa, ObjC, Python, etc.) Of course, there might be infinite many characters which might …

Total answers: 13

Objective-C (cocoa) equivalent to python's endswith/beginswith

Objective-C (cocoa) equivalent to python's endswith/beginswith Question: Python has string.startswith() and string.endswith() functions which are pretty useful. What NSString methods can I use to have the same function? Asked By: prosseek || Source Answers: You want the hasPrefix and hasSuffix messages. I tend to also use the compare:options: message pretty regularly to achieve the same …

Total answers: 3