Find Jobs
Hire Freelancers

Function to Read short text file into Swift

$10-30 USD

Preklicano
Objavljeno pred več kot 6 leti

$10-30 USD

Plačilo ob dostavi
I need a Swift 4 function in OSX to read in text files with the following format: 8 Fill Level 0% 8 0 0.1 0.2 0.3 0.5 0.7 0.8 1 0.05 0.04 0.04 0.035 0.03 0.03 0.02 0 10% 9 0 0.1 0.15 0.2 0.3 0.5 0.7 0.9 1 0.4 0.4 0.4 0.25 0.26 0.26 0.25 0.25 0 ... Here is the ~~ c# code that read it in. You don't need to follow this code but it shows the structure. Hopefully there is an easier way to read this in with Swift. var NFL: Int var NP: [Int] var FLEV: [Double] var GNU: [[Double]] var LAM: [[Double]] init() { var type = 4 } /// <summary> /// Read Fluid Curves /// </summary> func ReadFluidCurves() -> Bool { var fileName = "[login to view URL]" StreamReader input = new StreamReader(fileName); NFL = [login to view URL]( ReadJunk( input)); FLEV = new double[NFL]; NP = new int[NFL]; GNU = new double[NFL][]; LAM = new double[NFL][]; for (int i=0;i<NFL;i++) { FLEV[i] = [login to view URL]( ReadJunk( input)); NP[i] = [login to view URL]( ReadJunk( input)); GNU[i] = new double[NP[i]]; for (int j=0;j<NP[i];j++) { GNU[i][j] = [login to view URL]( ReadJunk( input)); } LAM[i] = new double[NP[i]]; for (int j=0;j<NP[i];j++) { LAM[i][j] = [login to view URL]( ReadJunk( input)); } } return true } func ReadJunk(StreamReader input) -> String { char[] buffer = new char[10]; String buildup = ""; [login to view URL](buffer, 0, 1); while (buffer[0] == ' ' || buffer[0] == (char)13 || buffer[0] == (char)10 ) { [login to view URL](buffer, 0, 1); } buildup = new String( buffer[0], 1); [login to view URL](buffer, 0, 1); while (buffer[0] != ' ' && buffer[0] != (char)13 && buffer[0] != (char)10) { buildup = buildup + new String( buffer[0], 1);; [login to view URL](buffer, 0, 1); } return buildup; }
ID projekta: 15355752

Več o projektu

2 ponudb
Projekt na daljavo
Aktivno pred 7 leti

Želite zaslužiti?

Prednosti oddajanja ponudb na Freelancerju

Nastavite svoj proračun in časovni okvir
Prejmite plačilo za svoje delo
Povzetek predloga
Registracija in oddajanje ponudb sta brezplačna
2 freelancerjev je oddalo ponudbo s povprečno vrednostjo $70 USD za to delo
Avatar uporabnika
Hello, I've reviewed your job description very carefully and got the idea on what you are looking for. I can complete this project and also can start it quickly. Thanks Relevant Skills and Experience Objective C, Swift Proposed Milestones $100 USD - app
$100 USD v 1 dnevu
5,0 (13 ocen)
4,5
4,5

O stranki

Zastava UNITED STATES
Bonita Springs, United States
5,0
140
Plačilna metoda je verificirana
Član(ica) od okt. 25, 2004

Verifikacija stranke

Hvala! Po e-pošti smo vam poslali povezavo za prevzem brezplačnega dobropisa.
Pri pošiljanju vašega e-sporočila je šlo nekaj narobe. Poskusite znova.
Registrirani uporabniki Skupaj objavljenih del
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Nalaganje predogleda
Geolociranje je bilo dovoljeno.
Vaša prijavna seja je potekla, zato ste bili odjavljeni. Prosimo, da se znova prijavite.