我想拆分一个字符串女巫有一个可变的空白字符,但是我想消除很多空行.这段代码
$text = "Video Video Audio Audio VBI VBI"
$text.Split()
Run Code Online (Sandbox Code Playgroud)
输出这个
Video
Video
Audio
Audio
VBI
VBI
PS H:\>
Run Code Online (Sandbox Code Playgroud)
而且我想要这个
Video
Video
Audio
Audio
VBI
VBI
Run Code Online (Sandbox Code Playgroud)
很晚编辑:
注意到这个问题仍然有很多观点,所以我想澄清一下,当我问这个问题时,我对功能编程或正则表达式一无所知.
这里提到的所有解决方案都适用,因为有多种方法可以删除空格并从字符串创建数组.
我正在尝试使用该命令初始化一个firebase项目firebase init,但我得到了消息Error: Command requires authentication, please run firebase login.当我运行时firebase login,进程挂起并且不返回提示符:
以前我安装了最新的稳定版node.js和firebase-tools(with npm install -g firebase-tools).我正在使用Windows 8.1 x64机器.
firebase-debug.log文件的内容不报告任何错误或警告:
[debug] ----------------------------------------------------------------------
[debug] Command: C:\Program Files (x86)\nodejs\node.exe C:\Users\ \AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase login
[debug] Platform: win32
[debug] Node Version: v5.1.0
[debug] Time: Mon Nov 23 2015 13:49:06 GMT-0500 (Eastern Standard Time)
[debug] ----------------------------------------------------------------------
[debug]
Run Code Online (Sandbox Code Playgroud)
如何调试login命令?Nomaly它应该打开一个浏览器窗口进行身份验证,但在我的情况下不会发生这种情况.
我有2个对象,我想合并,但似乎我找不到解决方案
Messages Name Error
-------- ---- -----
{\\APPS-EUAUTO1\C$\Users\xautosqa\AppDa... test 1 True
{[APPS-EUAUTO1] [prep] Setting agent op... test 2 False
TestPlan Script TestCase TestData ErrorCount ErrorText DateTime Elapsed
-------- ------ -------- -------- ---------- --------- -------- -------
D:\XHostMach... D:\XHostMach... rt1 1,\a\"" 1 [#ERROR#][AP... 2014-03-28 1... 0:00:18
D:\XHostMach... D:\XHostMach... rt2 1,\a\"" 0 2014-03-28 1... 0:00:08
Run Code Online (Sandbox Code Playgroud)
我试过了 :
function Join-Object {
Param(
[Parameter(Position=0)]
$First
,
[Parameter(Position=1,ValueFromPipeline=$true)]
$Second
)
BEGIN {
[string[]] $p1 = $First | gm -type Properties | select -expand Name
}
Process …Run Code Online (Sandbox Code Playgroud) 基本上我想隐藏输入文件并使用按钮来选择表单中的文件.
如果我<label for="input-file">Label</label>在单击标签时使用,我可以选择一个文件,但我想成为一个按钮或者至少看起来像一个按钮.
这是JSFiddle中的代码示例:
input[type=file] { display: none; }
<form>
<input type="file" id="input-file">
<label for="input-file">
<button>Button</button>
</label>
<input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
如果我只是标签中的一个按钮,它就像一个提交按钮,如果我指定它的类型,它在点击时什么都不做.
是否有任何方法可以使用我的按钮或按钮查看控件而不是使用input type="file"?来在表单中上传文件?
它必须是HTML-CSS解决方案,没有JS或任何框架.
编辑:
这个CSS代码label看起来像一个标准按钮:
label {
appearance: button;
-moz-appearance: button;
-webkit-appearance: button;
text-align: center;
padding: 2px 6px 3px;
border: 2px outset buttonface;
font: 13.3333px Arial;
}
Run Code Online (Sandbox Code Playgroud) 我对 Prolog 很陌生,我偶然发现了一些我不明白的东西。
这是我的代码:
:- dynamic user/3.
user('id', 'Name', 20).
changeAge(Id, NewAge) :-
user(Id, Name, _),
retract(user(Id,_,_)),
assert(user(Id,Name,NewAge)).
Run Code Online (Sandbox Code Playgroud)
要更新数据库中的用户信息,
changeAge/2请执行以下三个步骤:
user/3。retract/1。assert/1。这是我的控制台输出:
1 ?- user('id', _, Age).
Age = 20.
2 ?- changeAge('id', 25).
true.
3 ?- user('id', _, Age).
Age = 25.
4 ?- changeAge("id", 30).
false.
5 ?- user('id', _, Age).
Age = 25.
Run Code Online (Sandbox Code Playgroud)
为什么单引号给我true(第 2 行),而双引号给我false(第 4 行)?
我是哈斯凯尔的新手.我读了这个答案,我还想测试我的函数的类型,如果有办法的话.这是一个例子:test.hs
module Test where
import Test.HUnit
test1 = TestCase (assertEqual "test1" 3 (length [1,2,3]))
tests = TestList [test1]
main :: IO Counts
main = runTestTT tests
Run Code Online (Sandbox Code Playgroud)
我正在运行代码,runghc test.hs我得到:
Cases: 1 Tried: 1 Errors: 0 Failures: 0
Run Code Online (Sandbox Code Playgroud)
现在,我该如何测试length函数的类型?
我已经尝试添加第二个测试test2 = TestCase (assertEqual "test2" "length :: Foldable t => t a -> Int" :type length),但是我收到了这个错误 test.hs:5:77: parse error on input 'type'.
谢谢
我正在学习Haskell中的异常如何工作.
当试图在Prelude中复制这个简单的例子时,我得到:
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
Prelude> :m Control.Exception
Prelude Control.Exception> let x = 5 `div` 0
Prelude Control.Exception> let y = 5 `div` 1
Prelude Control.Exception> print x
*** Exception: divide by zero
Prelude Control.Exception> print y
5
Prelude Control.Exception> try (print x)
<interactive>:16:1:
No instance for (Show (IO (Either e0 ())))
arising from a use of `print'
In a stmt of an interactive GHCi command: print it
Prelude Control.Exception>
Run Code Online (Sandbox Code Playgroud)
为什么我得到任何情况下错误的try(print …