Linked Questions

0 votes
0 answers
472 views

I want to read and display a very large file of text, how do I slice it and read it chunk by chunk to avoid using huge amounts of memory? The idea is to read first 1mb for example, then convert to ...
Vladislav's user avatar
  • 1,502
845 votes
41 answers
548k views

How do you get the length of a String? For example, I have a variable defined like: var test1: String = "Scott" However, I can't seem to find a length method on the string.
Scott Walter's user avatar
  • 9,512
305 votes
23 answers
222k views

How can I remove last character from String variable using Swift? Can't find it in documentation. Here is full example: var expression = "45+22" expression = expression.substringToIndex(...
Konstantin Cherkasov's user avatar
141 votes
18 answers
157k views

What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of ...
user avatar
76 votes
11 answers
70k views

I just started learning Swift. I have got my code to read from the text file, and the App displays the content of the entire text file. How can I display line by line and call upon that line multiple ...
ScarletEnvy's user avatar
54 votes
11 answers
49k views

I have a text file having data as given e.g. ...
Greshi Gupta's user avatar
23 votes
3 answers
18k views

C.f. Apple's website page on Swift: https://developer.apple.com/swift/ Are there blocks in Swift like in objective-c? How are they created and called? How would do an asynchronous request in Swift? ...
Alexis Pribula's user avatar
7 votes
1 answer
11k views

I have the following text file structure (the text file is pretty big, around 100,000 lines): A|a1|111|111|111 B|111|111|111|111 A|a2|222|222|222 B|222|222|222|222 B|222|222|222|222 A|a3|333|333|...
Igor Tupitsyn's user avatar
15 votes
1 answer
7k views

I am trying to take incoming microphone audio and stream it to another iPhone. Basically a phone call but via bluetooth. I have the audio coming in via AVAudioRecorder: func startRecording() { ...
iSkore's user avatar
  • 7,579
8 votes
1 answer
9k views

I read through these SO links for the answer 1. Read a file/URL line-by-line in Swift 2. Read and write data from text file Link 2 Provided me the solution but the problem is directory. It is by ...
iamprem's user avatar
  • 636
3 votes
1 answer
7k views

In my app documents folder I have a file which I am trying to read byte-per-byte into an array of UInt8 where each element represents a byte. How would I go about doing this? The file happens to be ...
Lahav's user avatar
  • 791
9 votes
2 answers
1k views

I have a requirement to parse data files in "txf" format. The files may contain more than 1000 entries. Since the format is well defined like JSON, I wanted to make a generic parser like JSON, which ...
Anupdas's user avatar
  • 10.2k
1 vote
1 answer
1k views

I'm retrieving a string from url content, this way: NSString *urlStr = [NSString stringWithFormat:@"http://www.example.com/string_to_retrieve"]; NSURL *url = [NSURL URLWithString:urlStr]; NSString *...
Fabius's user avatar
  • 528
2 votes
1 answer
2k views

I have been having issues processing large files. At first I was blaming the parser, so I wrote one, but still have the same issues. If I use this code to scan a 1,000,000 record file (250 MB), it ...
Mozahler's user avatar
  • 5,363
2 votes
3 answers
1k views

I know Python and I'm trying to learn Swift... I am trying to figure out how to just read a plain text file from an absolute file path In Python, #!/usr/bin/python path= '/users/mu/desktop/...
O.rka's user avatar
  • 31k

15 30 50 per page