How to declare a string in Objective C

Overview

A string is a group of characters joined together. Objective C is based on C language and its string objects can be created using NSString class.

Declaration

In order to declare a string in Objective C, the character @, followed by the actual content of the string enclosed in double quotes(""), is used.

Syntax

In the code below, the string "Welcome to Educative" is declared using the NSString in Objective C.

NSString *welcome = @"Welcome to Educative";

Free Resources