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

  • 关于我们
  • 免责声明