搜索具有多个double值的字符串,用于某个double值?

时间:2016-10-14 04:17:55

标签: java string search double substring

我必须为我的计算机科学课程创建一个计算器。我可以计算双值,如果它们只是3.4或6.8这样的数字,而其他双值如64.7或6.78将无法工作,因为我搜索字符串的双精度数。我想知道是否有任何方法可以找到字符串中的双打。附:我知道使用开关可以更轻松地测试操作员。我正在努力。

function myTrigger() {
  var time = new Date();
  // maybe check to see if it's night or other times that dealers won't update
  // that way you can return early and don't waste quota hours

  var dealerSpreadsheetIds = ["id1", "id2", ...];
  var dealerSheetName = "Deals";

  for (var i = 0; i < dealerSpreadsheetIds.length; i++) {
    var sheet = SpreadsheetApp.openById(dealerSpreadsheetIds[i]).getSheetByName(dealerSheetName);
    // check Deals sheet ranges for updates
    // if there is an update, update the main spreadsheet
  }
}

}

1 个答案:

答案 0 :(得分:0)

使用下面的代码段来提取两个输入和运算符。

String[] tokensVal = userProblem.split("[-+*/%]");
firstInput = tokensVal[0].trim();
secondInput = tokensVal[1].trim();
operator = userProblem.charAt(tokensVal[0].length());