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 8225873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:33:48+00:00 2026-06-07T15:33:48+00:00

I have a textview that already has text extracted from a website. So, let’s

  • 0

I have a textview that already has text extracted from a website. So, let’s say the text in the text view has this text:

Save Location 

84°F 

Clear 

Feels like 90°F

In this text, how can I extract the text that says 84 in the “84°F” to a string? Remember that the 84 is a constantly changing variable from the website so sometimes it’ll be a different number and I can’t search for the number directly. If you know how to do this please let me know 🙂 Thanks for your time.

  • 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-06-07T15:33:51+00:00Added an answer on June 7, 2026 at 3:33 pm

    Try something like this:

    NSString *originalString = @"Save Location 84°F Clear Feels like 90°F";
    
    NSMutableString *stringWithNums = [NSMutableString stringWithCapacity:originalString.length];
    
    NSScanner *scanner = [NSScanner scannerWithString:originalString];
    NSCharacterSet *numbers = [NSCharacterSet 
                           characterSetWithCharactersInString:@"0123456789"];
    
    while ([scanner isAtEnd] == NO) {
        NSString *buffer;
        if ([scanner scanCharactersFromSet:numbers intoString:&buffer]) {
            [stringWithNums appendString:buffer];
    
        } else {
            [scanner setScanLocation:([scanner scanLocation] + 1)];
            [stringWithNums appendString:@" "];
        }
    }
    

    Now stringWithNums will contains something like this:

    84 (some spaces) 90

    Then you could parse stringWithNums like this:

    NSArray *tempArray = [stringWithNums componentsSeparatedByString: @" "];
    NSString *finalTemperature;
    
    for(int index = 0; index < [tempArray count]; index++){
    
        if([[tempArray objectAtIndex:index] intValue] != 0 && [[tempArray objectAtIndex:index] intValue] < 200){
            finalTemperature = [tempArray objectAtIndex: index];
            break;
        }
    }
    

    finalTemperature will contain “84”. You could put this in method form and pass in originalString as an argument so you could reuse this code. Hope this helps and if you have any questions, make sure to ask in the comments!

    UPDATE:
    I added this line:
    && [[tempArray objectAtIndex:index] intValue] < 200

    to the if statement above, so it now looks like this:

    if([[tempArray objectAtIndex:index] intValue] != 0 && [[tempArray objectAtIndex:index] intValue] < 200){
    

    In the website text, it looks like the only number before the “82” is a zip code, which is 5 digits long. In reality, all temperatures (on Earth) are below 200 (3 digits), so the extra line I put in makes sure that the final temperature is a three or less digit number and not a 5 digit zip code.

    Hope this helps!

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

Sidebar

Related Questions

Let's say you have a TextView that displays an number like 0 and you
I have already created a dynamic list view that passes text to a SimpleAdapter,
I have a Linear Layout that has a Button and a TextView on it.
I have a custom Dialog that contains only a TextView to display some text
I have a multi-line text view that can get quite large. When the user
I have the following app that has a textview and an edittext. When the
I have already read this post: Making TextView scrollable on Android without success. My
I have a LinearLayout view that already contains several elements. I want to add
I have a UINavigationBar that has two button items already. I will need to
I have a TextView that displays an error message in the login page of

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.