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
1 answer

search string starts and ends with in a multiple occurance of same string

I appoligize for the same question but i didnt got the answer i was trying for 2 days m not getting it , can any one help me . i need to find and print only the string which starts and ends with "&". but in my string lots of same occurance of "&"…
Diaaaaan
  • 35
  • 6
0
votes
1 answer

Get range of part of NSString before and after a certain character

I have a pretty simple question, however I don't know how to approach it off the top of my head. I'd like to get the range of two parts of my NSString. I've got a time, let's say 9:42, and I want to isolate the NSRange of the hour and minute portion…
mhbdr
  • 753
  • 2
  • 10
  • 26
0
votes
1 answer

Division by defined constant in Obj-C does not work

If I write #define ANOTHER_CONSTANT 200 #define MYDIVISOR 1000/ANOTHER_CONSTANT and then a method - (void)result { NSRange range = [@"--BB-------A----" rangeOfString:@"A" options:NSBackwardsSearch]; int rest = range.location % MYDIVISOR; …
Katlu
  • 496
  • 6
  • 14
0
votes
1 answer

Setting NSRange from high to low

I need to provide an NSRange to the assetLibrary to run on the user photo library. I want to start from the end . I cant find a way to give a range that starts from the end . NSRange range; range.length=[group numberOfAssets]; NSIndexSet *set =…
user1994291
0
votes
2 answers

How can I make a nsdictionary out of it with string objects as the key and array of postion as the object for the key

Basically I have an array of nsstring objects like 'A',L,L,A,H,A,B,A,D. The output should be NSDICTIONARY 0,3,5,7 FOR KEY A, 1,2 FOR KEY L 4 FOR KEY H 6 FOR KEY B 8 FOR KEY D.
Desparado_
  • 605
  • 6
  • 7
0
votes
3 answers

extracting double value using NSRange

I have a string "Number: 0.3456" How can I remove the "Number: " part to extract the double value "0.3456" from it using NSRange?
K Hsueh
  • 610
  • 1
  • 10
  • 19
0
votes
2 answers

MacRuby pointers and Obj-C function returning a value by reference

I am trying to implement the following method of NSAttributedString in Macruby: (id)attribute:(NSString *)attributeName atIndex:(NSUInteger)index effectiveRange:(NSRangePointer)aRange As by definition, it Returns the value for an attribute with a…
kwicher
  • 2,092
  • 1
  • 19
  • 28
0
votes
2 answers

objectivec - nsrange calculation is strange

It is strange. I expected that the last NSLog print 3 but it wasn't NSString *value = @"0(234)6"; NSRange beginParenthesis = [value rangeOfString:@"("]; NSRange endParenthesis = [value rangeOfString:@")"]; if (beginParenthesis.location !=…
user1705636
  • 233
  • 1
  • 6
  • 14
0
votes
2 answers

How to replace multiple regular expression matches in NSString?

I would like to know how is it possible to replace specific characters of an NSString based on some regular expression ([A-G]#?). More analytically, I have a NSString full of chords and spaces e.g. " C A A# B". What I want is to change these…
user1644365
  • 59
  • 1
  • 2
  • 8
0
votes
3 answers

Searching for a string within an array for an NSRange

I am trying to search for a string within an array, but I only want to search the last five objects in the array for the string. I have been fiddling with every parameter I can find on NSRange to no avail. I would post some example code, but I…
jakenberg
  • 2,125
  • 20
  • 38
0
votes
1 answer

How to Parse NSString from index to index?

I would like to parse a string like this: NSString *str = @"firstcolumn second column text Third Column Text"; I have three columns of text, each column could be text with spaces. I know how wide the columns, col1 = 10 chars long, col2 = 20, col3 =…
SMA2012
  • 161
  • 1
  • 3
  • 9
0
votes
1 answer

Regex syntax issues objective-c

NSString *inputStr=@"AA.BB Hello \nCC.JJ Say \nBB.CC Bye \nZZ.AA To"; NSRange r; while ((r=[inputStr rangeOfString:@"(^[A-L].*)" options:NSRegularExpressionSearch]).location!=NSNotFound) { NSString *newStr=[inputStr substringWithRange:r]; …
NNikN
  • 3,720
  • 6
  • 44
  • 86
0
votes
2 answers

How to fetch fields a from string

resultString is "{lhs: "100 Indian rupees",rhs: "1.8612 U.S. dollars",error: "",icc: true}" i have a string , in this four fields available . now how i can fetch second field of this string. Coz i want to use value = 1.8612 U.S. dollars. my problem…
0
votes
1 answer

NSRegularExpressions - filtering out words within Xcode

I'm currently teaching myself NSRegularExpressions and how to filter certain things out of RSS feeds. Particularly, the RSS feed is in the format "some text :: (there can be a Re: here for a reply) some text :: some text". I would like to remove…
TheCodingArt
  • 3,436
  • 4
  • 30
  • 53
0
votes
1 answer

Searching tableview using NSRange with characters from phone pad

I am trying to filter a table view of contacts (name and phone number) using the phone pad (old dumb-phone sms-style mapping from digits to characters) where a search for, say, "3862" could yield 3862, dumb, duna,fvoc... and so on. I have…
Chuckels5584
  • 551
  • 2
  • 6
  • 17