标签: multiline

在R脚本中将代码拆分为多行

我想在多个行中分割R脚本中的一行(因为它太长了).我怎么做?

具体来说,我有一条线,如

setwd('~/a/very/long/path/here/that/goes/beyond/80/characters/and/then/some/more')
Run Code Online (Sandbox Code Playgroud)

是否有可能将长路径分成多条线?我试过了

setwd('~/a/very/long/path/here/that/goes/beyond/80/characters/and/
then/some/more')
Run Code Online (Sandbox Code Playgroud)

用return键在第一行的末尾; 但这不起作用.

谢谢.

r multiline

130
推荐指数
6
解决办法
23万
查看次数

如何在node.js中执行多行字符串?

随着node.js的兴起,JavaScript中的多行字符串变得越来越必要.

  1. 有没有一种特殊的方法在Node.JS中执行此操作,即使它在浏览器中不起作用?
  2. 是否有任何计划或至少有功能要求我可以支持?

我已经知道你可以\n\在每一行的末尾使用,这不是我想要的.

string multiline node.js

114
推荐指数
6
解决办法
10万
查看次数

107
推荐指数
2
解决办法
25万
查看次数

设置UILabel行间距

如何修改多行中的行间距(行间距)UILabel?

objective-c multiline uilabel ios line-spacing

101
推荐指数
7
解决办法
10万
查看次数

JSON值是否可以包含多行字符串

我正在编写一个JSON文件,该文件将由Java程序读取.片段如下......

{
  "testCases" :
  {
    "case.1" :
    {
      "scenario" : "this the case 1.",
      "result" : "this is a very long line which is not easily readble.
                  so i would like to write it in multiple lines.
                  but, i do NOT require any new lines in the output.
                  I need to split the string value in this input file only.
                  such that I don't require to slide the horizontal scroll again and again while verifying the correctness of the statements. …
Run Code Online (Sandbox Code Playgroud)

json multiline

101
推荐指数
3
解决办法
11万
查看次数

Groovy多行字符串出了什么问题?

Groovy脚本引发错误:

def a = "test"
  + "test"
  + "test"
Run Code Online (Sandbox Code Playgroud)

错误:

No signature of method: java.lang.String.positive() is 
applicable for argument types: () values: []
Run Code Online (Sandbox Code Playgroud)

虽然这个脚本工作正常:

def a = new String(
  "test"
  + "test"
  + "test"
)
Run Code Online (Sandbox Code Playgroud)

为什么?

string groovy multiline

93
推荐指数
3
解决办法
7万
查看次数

正则表达式匹配多行文本块

在匹配跨越多行的文本时,我在使用Python正则表达式时遇到了一些麻烦.示例文本是('\n'是换行符)

some Varying TEXT\n
\n
DSJFKDAFJKDAFJDSAKFJADSFLKDLAFKDSAF\n
[more of the above, ending with a newline]\n
[yep, there is a variable number of lines here]\n
\n
(repeat the above a few hundred times).
Run Code Online (Sandbox Code Playgroud)

我想捕获两件事:'some_Varying_TEXT'部分,以及在一次捕获中位于其下方两行的大写文本的所有行(我可以稍后删除换行符).我试过几种方法:

re.compile(r"^>(\w+)$$([.$]+)^$", re.MULTILINE) # try to capture both parts
re.compile(r"(^[^>][\w\s]+)$", re.MULTILINE|re.DOTALL) # just textlines
Run Code Online (Sandbox Code Playgroud)

并且有很多变化没有运气.最后一个似乎逐个匹配文本行,这不是我真正想要的.我可以抓住第一部分,没问题,但我似乎无法捕捉4-5行的大写文本.我想match.group(1)是some_Varying_Text,group(2)是line1 + line2 + line3 +等,直到遇到空行.

如果有人好奇,它应该是构成蛋白质的氨基酸序列.

python regex multiline

86
推荐指数
4
解决办法
23万
查看次数

如何使用内联变量创建多行Python字符串?

我正在寻找一种在多行Python字符串中使用变量的简洁方法.说我想做以下事情:

string1 = go
string2 = now
string3 = great

"""
I will $string1 there
I will go $string2
$string3
"""
Run Code Online (Sandbox Code Playgroud)

我想看看$Perl中是否有类似的东西来表示Python语法中的变量.

如果不是 - 用变量创建多行字符串的最简洁方法是什么?

python string variables multiline

78
推荐指数
7
解决办法
9万
查看次数

指定多行文本框的maxlength

我正在尝试使用asp:

<asp:TextBox ID="txtInput" runat="server" TextMode="MultiLine"></asp:TextBox>
Run Code Online (Sandbox Code Playgroud)

我想要一种方法来指定maxlength属性,但显然没有办法可以multiline textbox.我一直在尝试为onkeypress事件使用一些JavaScript :

onkeypress="return textboxMultilineMaxNumber(this,maxlength)"

function textboxMultilineMaxNumber(txt, maxLen) {
    try {
        if (txt.value.length > (maxLen - 1)) return false;
    } catch (e) { }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

虽然正常工作,但这个JavaScript函数的问题在于,在写入字符后,它不允许您删除和替换它们中的任何一个,这种行为是不可取的.

你有什么想法我可以在上面的代码中改变什么来避免这种或任何其他方式来绕过它?

asp.net textbox multiline maxlength

75
推荐指数
6
解决办法
12万
查看次数

如何在Android上的TextView中居中两行文本?

我想让它看起来像这样:

|    two    |
|   lines   |
Run Code Online (Sandbox Code Playgroud)

这是当前的布局,根本不起作用.

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="two\nlines"
        android:layout_gravity="center_vertical"
        android:layout_centerInParent="true"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

任何的想法?谢谢!

android text multiline text-alignment textview

75
推荐指数
2
解决办法
5万
查看次数