/// <summary> /// Ch名の一部にblackListが含まれているか? /// </summary> public bool ContainsBlack(string _ch, List <string> _blackList) { if (string.IsNullOrEmpty(_ch)) { return(false); } if (_blackList == null) { return(false); } //各パターンで検索 // ・normal 大文字全角ひらがなに変換 // ・nonNum 数字、記号除去 string ch_Normal = StrConv.ToUWH(_ch); string ch_NnonNum = StrConv.ToNonNum(ch_Normal); List <string> blackList = StrConv.ToUWH(_blackList).ToList(); //前方一致で検索 bool contains_Normal = blackList.Any((black) => ch_Normal.IndexOf(black) == 0); bool contains_NonNum = blackList.Any((black) => ch_NnonNum.IndexOf(black) == 0); if (contains_Normal) { return(true); } else if (contains_NonNum) { return(true); } else { return(false); } }
private void phaseTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.PhaseSpeed = StrConv.toFloat(phaseTxt.Text, wave_.PhaseSpeed); }
private void timeTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.setTime(StrConv.toFloat(timeTxt.Text, wave_.Time)); }
private void waveLengthTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.WaveLength = StrConv.toFloat(waveLengthTxt.Text, wave_.WaveLength); }
private void textBox1_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.Amplitude = StrConv.toFloat(amplitudeTxt.Text, wave_.Amplitude); }
private void peakedPowerTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.PeakedPower = StrConv.toFloat(peakedPowerTxt.Text, wave_.PeakedPower); }
static public int getInt(Dictionary <string, object> dict, string name, int init) { if (dict.ContainsKey(name) == false) { return(init); } return(StrConv.toInt(dict[name].ToString(), init)); }
private void dirTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.Degree = StrConv.toFloat(dirTxt.Text, wave_.Degree); }
private void centerYTxt_TextChanged(object sender, EventArgs e) { if (wave_ == null) { return; } wave_.Center = new Vector2( wave_.Center.x_, StrConv.toFloat(centerYTxt.Text, wave_.Center.y_) ); }
static public float[] getFloatArray(Dictionary <string, object> dict, string name) { if (dict.ContainsKey(name) == false) { return(null); } var array = dict[name] as List <object>; if (array == null) { return(new float[0]); } float[] outArray = new float[array.Count]; for (int i = 0; i < array.Count; ++i) { outArray[i] = StrConv.toFloat(array[i].ToString(), 0.0f); } return(outArray); }
/// <summary> /// Implements atoi() and itoa(). /// </summary> /// <param name="functionArgs">Arguments to the function.</param> /// <param name="convMethod">Specifies the formats between which we need to convert.</param> /// <returns>Tuple - converted format and the data type.</returns> public static Tuple <object, TokenType> Strconv(List <Tuple <object, TokenType> > functionArgs, StrConv convMethod) { var(arg, argType) = functionArgs[0]; if (convMethod == StrConv.Atoi) { if (argType != StringLiteral) { throw new ArgumentException($"fatal: in atoi() arg {arg} must be string."); } return(new Tuple <object, TokenType>(double.Parse((string)arg), Numeric)); } if (convMethod == StrConv.Itoa) { if (argType != Numeric) { throw new ArgumentException($"fatal: in atoi() arg {arg} must be numeric."); } return(new Tuple <object, TokenType>(((double)arg).ToString(CultureInfo.InvariantCulture), StringLiteral)); } throw new ArgumentException($"fatal: invalid conversion method {convMethod}"); }
private void worldCenterYTxt_TextChanged(object sender, EventArgs e) { worldCenter_.y_ = StrConv.toFloat(worldCenterYTxt.Text, worldCenter_.y_); }
private void worldWidthTxt_TextChanged(object sender, EventArgs e) { worldWidth_ = StrConv.toFloat(worldWidthTxt.Text, worldWidth_); }
private void gridHeightTxt_TextChanged(object sender, EventArgs e) { gridHeight_ = StrConv.toInt(gridHeightTxt.Text, gridHeight_); }
private void gridWidthTxt_TextChanged(object sender, EventArgs e) { gridWidth_ = StrConv.toInt(gridWidthTxt.Text, gridWidth_); }