Reputation: 9869
I would like to grab a number from a string.
The string is: "responseID: 1 is the return value";
Sometimes the number could be 1, or 3, 300, 3000...
I am trying to do this in objective C for the iphone.
I've tried NSPredicate
and NSRegularExpression
, but I can not seem to get the right regex to start with.
I tried "*[0-9]+*"
;
Does this return the "1" , "300" or whatever number to me when I call the regex?
Thank you!
Upvotes: 1
Views: 83
Reputation: 9869
Sorry, I was able to search again and found exactly what I was looking for: see this: Objective C: How to grab a number after a sub string from string
Upvotes: 0