Swift代码获取字符串中的值

时间:2016-05-08 14:37:58

标签: string swift

我使用SOAPEngine框架连接到我的webservice,这是我想从结果字符串中检索的结果GetResult =" True&#34 ;; 你能帮我吗 ?我正在使用Swift Xcode 7.3

  void magic(){
  FILE *fp,*fp1, *fp2, *fp3, *fp4, *fp5;
  char *fn, *fn1, *fn2, *fn3, *fn4, *fn5;
  int ch;

  fn1 = "new/carbon.txt";
  fn2 = "new/oxygen.txt";
  fn3 = "new/platinum.txt";
  fn4 = "new/silicon.txt";
  fn5 = "new/titanium.txt";

  fn = "elements.txt";

  // Read file
  fp = fopen(fn ,"r");
  if(fp == NULL){
    printf("Error opening %s for reading. Program terminated",fn);
  }

  // Write file
  fp1 = fopen(fn1, "w");
  fp2 = fopen(fn2, "w");
  fp3 = fopen(fn3, "w");
  fp4 = fopen(fn4, "w");
  fp5 = fopen(fn5, "w");

  if(fp1 == NULL || fp2 == NULL || fp3 == NULL || fp4 == NULL || fp5 == NULL){
    printf("Error opening %s for wrting. Program terminated",fn);
  }

  while( (ch= fgetc(fp)) != '\n')
    fputc(ch, fp1);

  while( (ch= fgetc(fp)) != '\n')
    fputc(ch, fp2);

  while( (ch= fgetc(fp)) != '\n')
    fputc(ch, fp3);

  while( (ch= fgetc(fp)) != '\n')
    fputc(ch, fp4);

  while( (ch= fgetc(fp)) != EOF)
    fputc(ch, fp5);

  printf("All files were created successfuly!.\n");
    fclose(fp1);
    fclose(fp2);
    fclose(fp3);
    fclose(fp4);
    fclose(fp5);
    fclose(fp);
}



  int main(){
    magic();
    return 0;
  }

由于

1 个答案:

答案 0 :(得分:0)

让sonuclar = dict [“Body”]![“GetResponse”] !! [“GetResult”]