在Lua声明如果奇怪(Strange if statement in Lua)
好吧所以我是Lua语言的新手,所以这可能是一个非常愚蠢的问题,但我遇到了以下声明,我不知道这意味着什么(即使经过一些搜索)
if (...) then -- Doing some stuff end
这意味着什么?
Okay so I am new to the Lua language so this could be a super stupid question, but I have come across the following statement and I have no idea what it means (even after some searching)
if (...) then -- Doing some stuff end
What does the
...
mean?
原文:https://stackoverflow.com/questions/20014044
最满意答案
感谢Hans Passant指出我正确的方向。 我通过在
while
语句之后添加这个代码来修复代码(在http://www.csharp411.com/cleanstripremove-binary-characters-from-c-string/上找到 ):foreach (char c in line) { odbcResultsNice.Append(Char.IsControl(c) ? ' ' : c); // replace bad char with space }
并且最后一行被更改为添加换行符:
odbcResultsNice.AppendLine();
我的输出现在看起来像这样:
[2556 0903 141433250 ram] 8 GB of RAM [2556 0903 141433250 cpu] wicked fast CPU! [2556 0903 141433640 xyz] a�b��������k'� 7�����H_ ���-v �L`�oƙ*= [2556 0903 141434000 gfx] it can play crysis ...
您可以在xyz日志行中看到空格,这些空格将替换有问题的字符。
Thanks to Hans Passant for pointing me in the right direction. I've fixed up the code by adding this right after the
while
statement (found on http://www.csharp411.com/cleanstripremove-binary-characters-from-c-string/):foreach (char c in line) { odbcResultsNice.Append(Char.IsControl(c) ? ' ' : c); // replace bad char with space }
And the last line was changed just to add a linebreak:
odbcResultsNice.AppendLine();
My output now looks like this:
[2556 0903 141433250 ram] 8 GB of RAM [2556 0903 141433250 cpu] wicked fast CPU! [2556 0903 141433640 xyz] a�b��������k'� 7�����H_ ���-v �L`�oƙ*= [2556 0903 141434000 gfx] it can play crysis ...
You can see the spaces in the xyz log line, which replace the offending characters.
相关问答
更多-
阅读Get-Help 'about_parameters' 大多数Windows PowerShell命令(如cmdlet,函数和脚本)都依赖于参数以允许用户选择选项或提供输入。 参数遵循命令名称并具有以下形式: -
参数的名称前有一个连字符( - ),它向Windows PowerShell发出信号,连字符后面的单词是参数名称。 选择以下任何方法将一个前导连字符作为字符串传递 PS D:\PShell> .\run.ps1 -r ... -
StringBuilder有一个public StringBuilder append(CharSequence s)方法。 StringBuilder实现了CharSequence接口,因此您可以将StringBuilder传递给该方法。 StringBuilder has a public StringBuilder append(CharSequence s) method. StringBuilder implements the CharSequence interface, so you can ...
-
我认为@Kirk Woll的想法真的是你想要去的方式(我个人发现IE脚本错误令人厌烦)... 但有一个Chrome扩展( Javascript错误通知器 ),旨在通知您脚本错误...也许这就是你以后。 I think @Kirk Woll's idea is really the way you'd want to go (I personally find the IE script errors painfully annoying)... But there is a Chrome extension ...
-
您也可以使用StringBuilder 。 这非常有效。 StringBuilder builder = new StringBuilder(); builder.AppendLine("Something happended"); builder.AppendLine("Wow "); 如果你做了很多,可能会更有效率,因为它不会创建大量的临时字符串。 You can also use StringBuilder. It is pretty efficient. StringBuilder builder ...
-
从套接字读取数据并将其附加到stringbuilder的问题(Issue with reading data from a socket and appending it to a stringbuilder)[2023-07-05]
我认为问题在于以下代码: while((character = isr.read()) != 13) { process.append((char)character); //here is the issue - it just continues to append until it runs out of memory } 即使到达流的末尾, isr.read()也会返回-1而不是13.有可能你从 ... -
感谢Hans Passant指出我正确的方向。 我通过在while语句之后添加这个代码来修复代码(在http://www.csharp411.com/cleanstripremove-binary-characters-from-c-string/上找到 ): foreach (char c in line) { odbcResultsNice.Append(Char.IsControl(c) ? ' ' : c); // replace bad char with space } 并且最后一行被 ...
-
xgboost.DMatrix可以通过设置“silent = True”来保持沉默(Can xgboost.DMatrix be silent by set “silent=True”)[2022-08-07]
这很有趣。 静默值被采用并传递给Wrapper,但似乎包装器并没有真正使用它! 这显示了相应的代码https://github.com/dmlc/xgboost/blob/master/src/c_api/c_api.cc#L202 哪个说: int XGDMatrixCreateFromFile(const char *fname, int silent, DMatrixHandle *out) ... -
当您在StringBuilder代码中使用它时,以下变量之一为null(但在工作代码中使用它时不为null): str (or the item in index [1]) header links querystr 使用调试器找出哪个是null,修复它,代码应该正常工作。 One of the following variables is null when you are using it in the StringBuilder code (but was not null when you use ...
-
尝试迭代csv文件时出现无提示错误(python)(Silent error when trying to iterate through a csv file (python))[2022-09-06]
您的方法存在两个问题。 第一个是打开相同的文件进行读/写(它可以在诸如fileinput之类的模块的帮助下完成,但由于没有csv支持,它会很混乱)。 第二个问题是你有嵌套for循环。 在第一行patch ,您已经用尽了panorama文件。 你需要的是两个非嵌套循环。 这是我的方法: import csv import sys if __name__ == '__main__': with open(sys.argv[1], 'rt') as patch_file, \ o ... -
如果您有java 8,则可以在处理这些代码时尝试使用此代码进行内联编辑 public static String scriptNoComment(String fileName) { Path filePath = Paths.get(fileName); try (Stream
stream = Files.lines(filePath)) { List linesWithNoComments = new ArrayList (); ...