代码之家  ›  专栏  ›  技术社区  ›  joseph taylor

这些被称为字符串格式化程序吗?

  •  -3
  • joseph taylor  · 技术社区  · 8 年前

    print("The value of x is $%a", x)
    

    x的值为4

    string str1 = "I like bacon.";
    string str2 = "I love bacon.";
    Debug.WriteLine(String.Find(str1, "I #$ Bacon")); >> True
    Debug.WriteLine(String.Find(str2, "I #$ Bacon")); >> True
    

    多年来,我一直想知道它们被称为什么,因为我有很多例子可以派上用场;如果我记得的话。

    1 回复  |  直到 8 年前
        1
  •  1
  •   Ron Alan    8 年前

    在C和C++中,它们被称为 "format specifiers" , " 占位符 格式化占位符