I am trying to figure out how to take a given NSString and convert it to camel case. I have seen lots of code samples out there for going back and forth between underscores_ and camel-case, but I am dealing with strings that are capitalized.
So if I had the string: 12345 SAMPLE STREET #12
or 789 N HASKELL STREET
, how would I be able to convert those to 12345 Sample Street #12
and 789 N Haskell Street
?
Sorry if it's a stupid question, but I'm pretty new to the objective-c / cocoa frameworks world.
Performing the . upper() method on a string converts all of the characters to uppercase, whereas the lower() method converts all of the characters to lowercase.
A static, plain-text Unicode string object that bridges to String ; use NSString when you need reference semantics or other Foundation-specific behavior.
NSString is a classSwift is interoperatable with Objective-C and converts some Objective-C types to Swift types. Types that can be converted between Obj-C and Swift are known as bridged types. String and NSString are example of such bridged types and hence you can assign NSString to a String variable.
If you create an object using a method that begins with init, new, copy, or mutableCopy, then you own that object and are responsible for releasing it (or autoreleasing it) when you're done with it. If you create an object using any other method, that object is autoreleased, and you don't need to release it.
-[NSString capitalizedString]
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