logo
  • 教程列表
  • SO官方文檔
  • D 語言入門
    • 安裝或設定
    • 從字串中讀取值
    • Hello World
  1. StackOverflow 文件
  2. D Language 教程
  3. D 語言入門
  4. 從字串中讀取值

從字串中讀取值

Created: November-22, 2018

import std.format;

void main() {
    string s = "Name Surname 18";
    string name, surname;
    int age;
    formattedRead(s, "%s %s %s", &name, &surname, &age);
    // %s selects a format based on the corresponding argument's type
}

有關格式字串的官方文件,請訪問: https : //dlang.org/phobos/std_format.html#std.format

  • Hello World
  • 安裝或設定

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明