Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3754822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:36:15+00:00 2026-05-19T09:36:15+00:00

When i NSLog the contents of my string it outputs: m3u8 as expected. Because

  • 0

When i NSLog the contents of my string it outputs:

m3u8

as expected. Because thats what I parse into the string.

Later when I do some compare to check is the string equal to m3u8 they fail.

NSRange match;
match = [aRadio.streamType rangeOfString: @"m3u8"];
if (match.location == NSNotFound) 
{
    NSLog(@" m3u8 Not MATCHED: %@",aRadio.streamType);
    //break;
}

if ([aRadio.streamType compare:@"m3u8" ] == NSOrderedSame)
{

    NSLog(@" m3u8 DETECTED: %@",aRadio.streamType);
}
else 
{
    NSLog(@"NO m3u8 DETECTED %@",aRadio.streamType);
    [self createStreamer];
    [streamer start];
}

The NSLogs show that there is a match from the first check and no detection for the 2nd check.

I would expect them both to see that the string contains m3u8 as confirmed by what is output by Radio.streamType in the NSLogs.

This is how i declared stramType

@property (nonatomic, retain) NSString *streamType;

Anybody able to explain where this odd behavior is coming from?

Thanks
-Code

EDIT

NSLog(@"Str len: %d",[aRadio.streamType length]); 

outputs 5 as the length.

I try and trim the string here of newlines

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string 
{ 

if(!currentElementValue) 
{
    currentElementValue = [[NSMutableString alloc] initWithString:string];
}
else
{   
    [currentElementValue appendString:string];
    [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet 
newlineCharacterSet]];
    [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet]];
    [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet 
controlCharacterSet]];
    [currentElementValue stringByTrimmingCharactersInSet:[NSCharacterSet 
nonBaseCharacterSet]];
    NSLog(@"Processing Value: %@", currentElementValue);
}   
}

but NSLog(@”Processing Value: %@”, currentElementValue); still drops to a newline to display whats contained in currentElementValue which is ‘m3u8’

Thanks
-Code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:36:15+00:00Added an answer on May 19, 2026 at 9:36 am

    you may want to attempt literal comparisons using something like isEqualToString:. There are of course more advanced options which introduce parameters for locale, diacratics, case insensitive, and so on — it depends on what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find NSLog() statements really hard to read because of the verbose date. Is
Possible Duplicate: Calling NSLog from C++: “Format string is not a string literal (potentially
When I send an object to NSLog, I get a string with three attributes.
I am trying to parse some JSON. I've passed a constant key value and
Hi I have a json string converted unsing the JSON framework into a dictionary
Currently I am trying to parse an xml string that I already have (no
I'm able to successfully parse the contents of a XML file using TouchXML, but
I need to compare a string from an url using NSutf8stringencoding in order to
I'm importing a plist into an NSDictionary object and want to change the contents
I'm trying to create an application, and in that I'm receiving some contents from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.