-2

I am new bie to xcode may be question is silly but I am lagging with my home work. In a file I want to read a specific character after the string.

I want to read all the character after the space.

ex:

asasasasasas
wewewewewewe
qwqwqwqwqwqw xyz_ 22 aaaaaaaaaaa bbbbbbbbbbb ccccccccccccccc ddddddddddddd
fgfgfgfgfgfgfg
ererererererer

abc_ 12 bbbbbbbbbb dddddddd
jkjkjkjkjkjkjk
lalallalalalal


everything is fine .. but i want to print after "xyz_ 22" as aaaaaaa then bbbb ccc

DD007
  • 1
  • 4
  • Means you want to show what is nsarray contain currently. – Vishal Dec 14 '12 at 10:11
  • 1
    Look at the documentation for NSArray and `componentsSeparatedByString` – Nick Bull Dec 14 '12 at 10:13
  • 1
    You seem to have just blindly copied some code from an answer to your other question without taking the time to work out what it is doing and how it is working. READ THE DOCUMENTATION. It's there for a reason – Nick Bull Dec 14 '12 at 10:16
  • to ur answer its easy NSArray*dd=[contentfile componentsSeperatedByString:@" "]; NSLog (@"%d",dd); .................. but mine is a big file ex: asasasasasas wewewewewewe qwqwqwqwqwqw xyz_ 22 aaaaaaaaaaa asasas bababab cacacac fgfgfgfgfgfgfg ererererererer abc_ 12 bbbbbbbbbb jkjkjkjkjkjkjk lalallalalalal after abc_12 i want to read "aaaaaaaa" then "asasasa" then "babababa" – DD007 Dec 14 '12 at 10:16
  • using whiteSpace :[contentfile componentsSeperatedByString:@" "]; – laxonline Dec 14 '12 at 10:16

2 Answers2

1

I think you seperate your string by whiteSpace

NSArray*dd=[contentfile componentsSeperatedByString:@" "];
Sumit Mundra
  • 3,891
  • 16
  • 29
0

Shouldn't it just be:

NSArray*dd=[contentfile componentsSeparatedByString:@" "];

Then you have an array of all the strings.

Roland Keesom
  • 8,180
  • 5
  • 45
  • 52