定义跨越多行的字符串

时间:2017-09-26 09:27:44

标签: r string

当字符串文字跨越多行时,可以在python中使用三引号"""..."""

>>> string = """\
... Usage: thingy [OPTIONS]
...      -h                        Display this usage message
...      -H hostname               Hostname to connect to
... """
>>> 

R中有这样的可能吗?

1 个答案:

答案 0 :(得分:4)

R字符串也支持这种行为:

    private Entities AddToContext(Entities context, T entity, int count, int commitCount, bool recreateContext)
    {
        context.Set<T>().Add(entity);

        if (count % commitCount == 0)
        {
            context.SaveChanges();
            if (recreateContext)
            {
                context.Dispose();
                context = new Entities();
                context.Configuration.AutoDetectChangesEnabled = false;
            }
        }

        return context;
    }

<强>输出:

string <- "
    ... Usage: thingy [OPTIONS]
    ...      -h                        Display this usage message
    ...      -H hostname               Hostname to connect to
    ... "

print(string)