Questions tagged [nsrange]

A structure used to describe a portion of a series—such as characters in a string or objects in an NSArray object.

343 questions
0
votes
2 answers

nsrange.location not exactly trouble makerange substring ios objective c

hi i have this string { "data": [ { "name": "Lorena Trujillo", "id": "500144123" }, { "name": "George Arcila", "id": "520311359" }, { "name": "Laura Victoria Mu\u00f1oz Rincon", "id": "528543677" }, { "name": "Camilo Andres Santacoloma Mejia", "id":…
0
votes
1 answer

How to substract string correctly?

i've got two strings in two objects: <div align="center"><img src="http://farm9.staticflickr.com/8448/7882675644_76605a2a3d_b.jpg" border="0" alt="" /></div>< <img…
Tomasz Szulc
  • 4,217
  • 4
  • 43
  • 79
0
votes
1 answer

Memory leak regarding NSRange

NSString *mob = (__bridge_transfer NSString *)ABMultiValueCopyValueAtIndex(mobNum, emailCounter); mob = [ApplicationSingleton FindMobileNumber:mob]; if ([favos rangeOfString:mob].location != NSNotFound) it gives…
Anand
  • 1,129
  • 7
  • 29
0
votes
1 answer

Why is my NSRange always 0?

I want to implement a delete key for my calculator app. My pseudocode for this was: foo = length of current number bar = length of current number-1 current number = current number with character at index (foo-bar) removed To do this in…
ironcyclone
  • 199
  • 1
  • 6
0
votes
1 answer

substringWithRange get Range or index out of bounds error

First is the code // It's a test string NSString* aString = @",{id:\"bd\",name:\"ac\",latlng {lat:37.492488999999999,lng:127.014357}}"; // NSString *strRegex = @"latlng:\\ \\{(\\S*?)[^}]*\\}"; NSString *strRegex =…
Steven Jiang
  • 1,006
  • 9
  • 21
0
votes
2 answers

Objective-C, get string from text file?

I know there are a few different ways to find text in file, although I haven't found a way to return the text after the string I'm searching for. For example, if I was to search file.txt for the term foo and wanted to return bar, how would I do that…
Joe Habadas
  • 628
  • 8
  • 21
0
votes
1 answer

How to add UILabel between two strings

i have this code to show some texts in a UITextview..i just want to add a UILabel between these strings.i am getting text in this formate, 1 this is first text 2 this is second text 3 this is third text,,i want to add or append UILabel between…
stackiphone
  • 1,245
  • 3
  • 19
  • 41
-1
votes
1 answer

iPhone SDK: Grouped UITableView Sections, List Items not showing under correct section

I have a grouped uitableview which has several sections. The sections are showing up fine and the number of rows is correct, however there is a problem with the positioning of the list items. I have an NSMutableArray with a list of names, I then…
David Cahill
  • 419
  • 2
  • 5
  • 9
-1
votes
1 answer

Getting NSRangeException Beyond Bounds Crash

I have this code that is crashing with error *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray objectAtIndex:]: index 0 beyond bounds for empty array' at this line: - (UITableViewCell *)tableView:(UITableView…
Jon
  • 4,732
  • 6
  • 44
  • 67
-1
votes
2 answers

How to create range in swift for switch case.?

How to create range in swift for 0,5,10 & 1,2,3,4,6,7,8,9: switch currentIndex { case 0,5,10: segment = .fullWidth case 1,2,3,4,6,7,8,9:// Can't write infinity range here need formula segment = .fiftyFifty …
Amit
  • 556
  • 1
  • 7
  • 24
-1
votes
1 answer

Swift range check > in switch

The following code doesn't compile in Swift. What is the best way to alternatively express it? //f1 & f2 are float vars between 0 & 1 switch value { case 0...f1: break case >f1..f1+f2: …
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
-1
votes
2 answers

NSRange with location on iOS13 Not Working

My code not working with NSRange location on iOS13, on iOS12 and below it's work. Is there a way to color the text from the letters to be colored until the total letters afterwards? because I only have data starting from the colored letters and the…
Loren Ramly
  • 1,091
  • 4
  • 13
  • 21
-1
votes
2 answers

range function and crash in swift 3

My below code crashes: func getrange(_ from: Int, length: Int) -> Range? { guard let fromU16 = utf16.index(utf16.startIndex, offsetBy: from, limitedBy: utf16.endIndex), fromU16 != utf16.endIndex else { return nil …
user1452936
  • 555
  • 1
  • 6
  • 14
-1
votes
1 answer

Is it possible to find the rangeOfString for multiple items at once

I want to find the rangeOfString for multiple items and have tried using an array with a for-in loop, however this just cycles to the last term of the array and uses that for the rangeOfString. Is it possible to use an array with rangeOfString so it…
SandySunday
  • 41
  • 1
  • 2
-1
votes
1 answer

Is it possible to get a rangeOfString from a group of items in an array?

What i've tried was using a for-in loop, however that just cycles to the last value and gives me the rangeOfString for that value. It would be a lot to write the rangeOfString for all the values i want but if needed I don't mind. I just wanted to…
JoanDoe
  • 13
  • 3
1 2 3
22
23