-1

Here is my string

<![CDATA[https://2134114018c95327dd42-9b7f7e536ddb2ed4dd0d87c2f0e46492.ssl.cf2.rackcdn.com/340x340/8663034_19227_$2014_03_28_10_30_34_3934.JPG]]>

I am stuck at this point. I just want to remove CDATA from this string. Is there amy quick work around for that ?

NSPratik
  • 4,714
  • 7
  • 51
  • 81

1 Answers1

2
[str stringByReplacingOccurrencesOfString:@"CDATA" withString:@""];

this should help

EDIT:

NSString *haystack = @"<![CDATA[https://2134114018c95327dd42-9b7f7e536ddb2ed4dd0d87c2f0e46492.ssl.cf2.rackcdn.com/340x340/8663034_19227_$2014_03_28_10_30_34_3934.JPG]]>";

NSString *prefix = @"<![CDATA["; 
NSString *suffix = @"]]>"; 
NSRange needleRange = NSMakeRange(prefix.length,
                                  haystack.length - prefix.length - suffix.length);
NSString *needle = [haystack substringWithRange:needleRange];

Needle is your url path

Peter Lendvay
  • 565
  • 4
  • 22