user1135750
user1135750

Reputation:

Text length in Objective-C

Please tell me the difference between test.length and [test length]?

Which is more usefull for iOS developement?

Upvotes: 0

Views: 258

Answers (3)

Vincent
Vincent

Reputation: 4409

They are the same. Sometimes it may (!) be better to use one or the other for readability of your code.

Upvotes: 0

Manlio
Manlio

Reputation: 10864

No difference in meaning, they both access length property.

Their only difference is syntactic.

Check Apple documentation about sending a message to an object

Upvotes: 8

Joachim Isaksson
Joachim Isaksson

Reputation: 181077

test.length is just a convenience syntax introduced in Objective C 2.0. The two expressions you list are totally equivalent and a matter of preference more than anything else.

Upvotes: 2

Related Questions