评估字符串到数组

时间:2020-04-09 01:02:22

标签: excel vba

我正在使用这样的行,以便将变量a分配给数组,并且效果很好

.rating-slider__inner-container {
  position: relative;
  padding-top: 100px;
}

.rating-slider__input {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  background: $form-gray;
  &:focus {
    outline: none;
  }
}

.rating-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  background: transparent;
  border-color: transparent;
  height: 20px;
  width: 20px;
  margin-top: -8px;
  cursor: pointer;
}

.rating-slider__input::-moz-range-thumb {
  background: transparent;
  border-color: transparent;
  height: 20px;
  width: 20px;
  cursor: pointer;
}

.rating-slider__input::-moz-focus-outer {
  border: 0;
}

.rating-slider__thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 50px;
  left: -10px;
  font-size: $text-3xl;
  pointer-events: none;
}

.rating-slider__value {
  color: $brand-primary;
  font-size: $text-lg;
}

.rating-slider__range-labels-container {
  display: flex;
  justify-content: space-between;
}

现在我将其存储在字符串中

a = [{"From","To";1,2;2.5,3.5;3.5,5;5.7,7}]

如何从字符串本身返回数组?我尝试使用评估,但这会引发错误

    s = "[{""From"",""To"";1,2;2.5,3.5;3.5,5;5.7,7}]"
a = Evaluate(s)

1 个答案:

答案 0 :(得分:0)

我可以弄清楚

    s = "[{""From"",""To"";1,2;2.5,3.5;3.5,5;5.7,7}]"
a = Evaluate(Replace(Replace(s, "[", ""), "]", ""))

但是我欢迎更多的想法和建议。

相关问题