Reputation: 139
So, if I have a string x
, and x.length
returns the count of characters in it,
how do I turn the return of string.length
into an int?
I looked for duplicate questions but I don't think there are.
Thanks
Upvotes: 1
Views: 1492
Reputation: 490058
The cast has already pointed out. Now, let me advise against using it, at least as a rule.
There's a reason it returns an unsigned integer type (among other things, because it might overflow what a signed integer can hold). You normally want to keep it as an unsigned type instead of converting it to int
.
Upvotes: 2