我有两个字符串:
string a = "00001"; /* which is decimal 1 I've converted with next string:
string a = Convert.ToString(2, 2).PadLeft(5, '0'); */
string b = "00010";
Run Code Online (Sandbox Code Playgroud)
我想在两者之间执行二进制加法,所以答案将是00011(3).
我试图拆分具有由新行分隔的多个值的单元格,它适用于具有多于1个值的单元格,但是如果我得到一个只有1个值的单元格(即,没有换行符,则错误输出)我能解决这个问题吗?
function splitColumnAndRepeatRows(anArray, splitColumnIndex)
{
var output = [];
for (i in anArray)
{ // for each row
var splitArray = anArray[i][splitColumnIndex].split("\n"); // split values in specified column
for (j in splitArray)
{ // for each split cell value
if(splitArray[j]=="")
continue;
var row = anArray[i].slice(0); // take a copy of source row
//row[splitColumnIndex] = alltrim(splitArray[j]); // replace comma separated value with current split value
row[splitColumnIndex] =splitArray[j];
output.push(row); // push new row to output
}
}
return output;
}
Run Code Online (Sandbox Code Playgroud)
链接到电子表格:https …