Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

objective-c
communitycreator

How to declare a string in Objective C

Mahnoor Zaheer

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";
The syntax of declaring a string in Objective C

RELATED TAGS

objective-c
communitycreator
RELATED COURSES

View all Courses

Keep Exploring