/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> /// <remarks></remarks> public override int GetHashCode() { unchecked { return(((String1 != null ? String1.GetHashCode() : 0) * 397) ^ (String2 != null ? String2.GetHashCode() : 0)); } }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var string1 = String1.Get(context); var string2 = String2.Get(context); double in_percent = new double(); string a = string1; string b = string2; char[] turkishChars = { 'ý', 'ð', 'Ý', 'Ð', 'ç', 'Ç', 'þ', 'Þ', 'ö', 'Ö', 'ü', 'Ü' }; char[] englishChars = { 'i', 'g', 'I', 'G', 'c', 'C', 's', 'S', 'o', 'O', 'u', 'U' }; // Match char for (int i = 0; i < turkishChars.Length; i++) { a = a.Replace(turkishChars[i], englishChars[i]); b = b.Replace(turkishChars[i], englishChars[i]); } a = a.ToLower().ToUpper(); b = b.ToLower().ToUpper(); if (string.IsNullOrEmpty(a)) { in_percent = b.Length; } if (string.IsNullOrEmpty(b)) { in_percent = a.Length; } int lengthA = a.Length; int lengthB = b.Length; var distances = new int[lengthA + 1, lengthB + 1]; for (int i = 0; i <= lengthA; distances[i, 0] = i++) { ; } for (int j = 0; j <= lengthB; distances[0, j] = j++) { ; } for (int i = 1; i <= lengthA; i++) { for (int j = 1; j <= lengthB; j++) { int cost = b[j - 1] == a[i - 1] ? 0 : 1; distances[i, j] = Math.Min(Math.Min(distances[i - 1, j] + 1, distances[i, j - 1] + 1), distances[i - 1, j - 1] + cost); } in_percent = distances[lengthA, lengthB]; in_percent = (1.0 - ((double)in_percent / (double)Math.Max(a.Length, b.Length))) * 100; } // Outputs return((ctx) => { Percentage.Set(ctx, in_percent); }); }
protected override void Execute(CodeActivityContext context) { string string1 = String1.Get(context); string string2 = String2.Get(context); Int32 result = FuzzySharp.Fuzz.Ratio(string1, string2); Result.Set(context, result); }
public StandardGuitar() : base() { String1.SetTuneNote("E", 4); String2.SetTuneNote("B", 3); String3.SetTuneNote("G", 3); String4.SetTuneNote("D", 3); _guitarStrings.Add(new GuitarString("A", 2)); _guitarStrings.Add(new GuitarString("E", 2)); }
public StandardGuitar() : base() { String1.SetTuneNote("E", 4); String2.SetTuneNote("B", 3); String3.SetTuneNote("G", 3); String4.SetTuneNote("D", 3); s5 = new GuitarString("A", 2); s6 = new GuitarString("E", 2); }
public static void ToLowerTrimmed_StringIsAlreadyLowercaseAndTrimmed_ReturnsOriginalString() { // Arrange const string String1 = @"a sdfj !@#$%^\&*()=+_?/.,mn2340-8938m fkls d"; // Act string actual1 = String1.ToLowerTrimmed(); // Assert Assert.Equal(String1, actual1); }
private string GetField() { if (String1 != null) { if (String1.Length > Convert.ToInt16(StartChar) + Convert.ToInt16(FieldLength)) { return(String1.Substring(Convert.ToInt16(StartChar) - 1, Convert.ToInt16(FieldLength))); } } return(null); }
/// <inheritdoc /> protected override void Execute(Context context) { var settings = new StringComparisonSettings { CaseSensitive = CaseSensitive.Get(context), AccentSensitive = AccentSensitive.Get(context) }; var result = StringComparisons.JaroWinklerDistance(String1.Get(context), String2.Get(context), settings); Result.Set(context, (int)Math.Round(result * 100)); }
public override int GetHashCode() { unchecked { var hashCode = String0.GetHashCode(); hashCode = (hashCode * 397) ^ String1.GetHashCode(); hashCode = (hashCode * 397) ^ String2.GetHashCode(); hashCode = (hashCode * 397) ^ String3.GetHashCode(); hashCode = (hashCode * 397) ^ String4.GetHashCode(); hashCode = (hashCode * 397) ^ String5.GetHashCode(); return(hashCode); } }
/// <summary> /// Determines if String1 contains String2. /// </summary> public string String1ContainsString2() { if (String1 == String2) { return(Constants.YES); } if (String1 != null && String1.Contains(String2)) { return(Constants.YES); } return(Constants.NO); }
public void TestCamelCaseSplit() { const string String1 = "ThisIsOneTestString"; const string String2 = "ThisOneABCContainsAbreviation"; const string String3 = "ThisOneContainsASingleCharacterWord"; const string String4 = "ThisOneEndsWithAbbreviationABC"; const string String5 = "ThisOneEndsWithASingleCharacterWordZ"; var expected1 = new[] { "This", "Is", "One", "Test", "String" }; var expected2 = new[] { "This", "One", "ABC", "Contains", "Abreviation" }; var expected3 = new[] { "This", "One", "Contains", "A", "Single", "Character", "Word" }; var expected4 = new[] { "This", "One", "Ends", "With", "Abbreviation", "ABC" }; var expected5 = new[] { "This", "One", "Ends", "With", "A", "Single", "Character", "Word", "Z" }; var split1 = String1.CamelCaseSplit(); Assert.AreEqual(expected1.Length, split1.Count); for (int i = 0; i < expected1.Length; ++i) { Assert.AreEqual(expected1[i], split1[i]); } var split2 = String2.CamelCaseSplit(); Assert.AreEqual(expected2.Length, split2.Count); for (int i = 0; i < expected2.Length; ++i) { Assert.AreEqual(expected2[i], split2[i]); } var split3 = String3.CamelCaseSplit(); Assert.AreEqual(expected3.Length, split3.Count); for (int i = 0; i < expected3.Length; ++i) { Assert.AreEqual(expected3[i], split3[i]); } var split4 = String4.CamelCaseSplit(); Assert.AreEqual(expected4.Length, split4.Count); for (int i = 0; i < expected4.Length; ++i) { Assert.AreEqual(expected4[i], split4[i]); } var split5 = String5.CamelCaseSplit(); Assert.AreEqual(expected5.Length, split5.Count); for (int i = 0; i < expected5.Length; ++i) { Assert.AreEqual(expected5[i], split5[i]); } }
static void Main(string[] args) { Alert1 alert1 = new Alert1(); File1 file1 = new File1(); String1 string1 = new String1(); Console.WriteLine("Enter path to file:"); string line1 = file1.ToLine(Console.ReadLine()); if (string1.IsPalindrome(line1)) { alert1.Throw("Your string is Palindrom"); } else { alert1.Throw("Your string is NOT Palindrom"); } Console.ReadKey(); }
/// <summary> /// Constructor /// </summary> /// <param name="efsSystem"></param> public Concat(EfsSystem efsSystem) : base(efsSystem, "Concat") { String1 = (Parameter)acceptor.getFactory().createParameter(); String1.Name = "String1"; String1.Type = EFSSystem.StringType; String1.setFather(this); FormalParameters.Add(String1); String2 = (Parameter)acceptor.getFactory().createParameter(); String2.Name = "String2"; String2.Type = EFSSystem.StringType; String2.setFather(this); FormalParameters.Add(String2); }
/// <summary> /// Pads String1 with necessary zeros to fill TotalWidth number of characters /// </summary> public string AddNumericPadding() { string sRet = String1; if (String1 != null) { if (String1.Length > TotalWidth) { sRet = String1.Substring(0, TotalWidth); } } else { sRet = new String('0', TotalWidth); } return(sRet.PadLeft(TotalWidth, '0')); }
/// <summary> /// Pads String1 with necessary spaces to fill TotalWidth number of characters /// </summary> public string AddPaddingtoEndOfString() { string sRet = String1; if (String1 != null) { if (String1.Length > TotalWidth) { sRet = String1.Substring(0, TotalWidth); } } else { sRet = new String(' ', TotalWidth); } return(sRet.PadRight(TotalWidth)); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { string string1 = String1.Get(executionContext); string string2 = String2.Get(executionContext); string joiner = Joiner.Get(executionContext); string joinedString = System.String.Join(joiner, string1, string2); JoinedString.Set(executionContext, joinedString); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } string string1 = String1.Get(context); string string2 = String2.Get(context); string joiner = Joiner.Get(context); string joinedString = string.Join(joiner, string1, string2); JoinedString.Set(context, joinedString); }
public override int GetHashCode() { int hash = 1; if (String1.Length != 0) { hash ^= String1.GetHashCode(); } if (String2.Length != 0) { hash ^= String2.GetHashCode(); } if (String3.Length != 0) { hash ^= String3.GetHashCode(); } if (String4.Length != 0) { hash ^= String4.GetHashCode(); } return(hash); }
public static void ToLowerTrimmed_StringNotLowercaseOrStringIsNotTrimmedOrBoth_ReturnsLowercaseTrimmedString() { // Arrange const string String1 = "This Is Not%(#*&! lower CASE"; const string Expected1 = "this is not%(#*&! lower case"; const string String2 = " this needs a trim "; const string Expected2 = "this needs a trim"; const string String3 = " LoWer Trimmed "; const string Expected3 = "lower trimmed"; // Act string actual1 = String1.ToLowerTrimmed(); string actual2 = String2.ToLowerTrimmed(); string actual3 = String3.ToLowerTrimmed(); // Assert Assert.Equal(Expected1, actual1); Assert.Equal(Expected2, actual2); Assert.Equal(Expected3, actual3); }
static void Main(string[] args) { string String1, String2; Console.WriteLine("Введите первую строку: "); String1 = Console.ReadLine(); Console.WriteLine("Введите вторую строку: "); String2 = Console.ReadLine(); for (int i = 0; i < String1.Length; i++) { if (String2.IndexOf(String1[i]) != -1) { String1 = String1.Insert(i, String1[i] + ""); i++; } } Console.WriteLine("Результат: " + String1); Console.ReadKey(); }
private void _read() { _code = ((PythonPickle.Opcode)m_io.ReadU1()); switch (Code) { case PythonPickle.Opcode.Ext4: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.Tuple1: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Setitem: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ReadonlyBuffer: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Stop: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Ext2: { _arg = m_io.ReadU2le(); break; } case PythonPickle.Opcode.EmptyTuple: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Newtrue: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Long: { _arg = new DecimalnlLong(m_io, this, m_root); break; } case PythonPickle.Opcode.Newobj: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Bytearray8: { _arg = new Bytearray8(m_io, this, m_root); break; } case PythonPickle.Opcode.Put: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.StackGlobal: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.PopMark: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Append: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Newfalse: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binpersid: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Build: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptyDict: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple2: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Long4: { _arg = new Long4(m_io, this, m_root); break; } case PythonPickle.Opcode.NextBuffer: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Appends: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binbytes: { _arg = new Bytes4(m_io, this, m_root); break; } case PythonPickle.Opcode.Dup: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.List: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Proto: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Pop: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Frame: { _arg = m_io.ReadU8le(); break; } case PythonPickle.Opcode.String: { _arg = new Stringnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Binunicode: { _arg = new Unicodestring4(m_io, this, m_root); break; } case PythonPickle.Opcode.Float: { _arg = new Floatnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Reduce: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.GlobalOpcode: { _arg = new StringnlNoescapePair(m_io, this, m_root); break; } case PythonPickle.Opcode.Binput: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Memoize: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Persid: { _arg = new StringnlNoescape(m_io, this, m_root); break; } case PythonPickle.Opcode.Ext1: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.None: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinunicode: { _arg = new Unicodestring1(m_io, this, m_root); break; } case PythonPickle.Opcode.Obj: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binfloat: { _arg = m_io.ReadF8be(); break; } case PythonPickle.Opcode.NewobjEx: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptyList: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binunicode8: { _arg = new Unicodestring8(m_io, this, m_root); break; } case PythonPickle.Opcode.Binget: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Dict: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binstring: { _arg = new String4(m_io, this, m_root); break; } case PythonPickle.Opcode.Setitems: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint2: { _arg = m_io.ReadU2le(); break; } case PythonPickle.Opcode.Binbytes8: { _arg = new Bytes8(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint1: { _arg = m_io.ReadU1(); break; } case PythonPickle.Opcode.Inst: { _arg = new StringnlNoescapePair(m_io, this, m_root); break; } case PythonPickle.Opcode.LongBinget: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.LongBinput: { _arg = m_io.ReadU4le(); break; } case PythonPickle.Opcode.Int: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.Binint: { _arg = m_io.ReadS4le(); break; } case PythonPickle.Opcode.Unicode: { _arg = new Unicodestringnl(m_io, this, m_root); break; } case PythonPickle.Opcode.Long1: { _arg = new Long1(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinstring: { _arg = new String1(m_io, this, m_root); break; } case PythonPickle.Opcode.Mark: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Frozenset: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Tuple3: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Additems: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.Get: { _arg = new DecimalnlShort(m_io, this, m_root); break; } case PythonPickle.Opcode.EmptySet: { _arg = new NoArg(m_io, this, m_root); break; } case PythonPickle.Opcode.ShortBinbytes: { _arg = new Bytes1(m_io, this, m_root); break; } } }
static void SetColumnValue(DataColumn dc, string value) { dc.Expression = Bool.String1.IsNumeric(value) ? value : String1.SingleQuote(value); }
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) { //validate if (item == null) { return(DefaultTemplate); } //get string var str = item as string; if (item.GetType().IsPrimitive || item.GetType().IsEnum) { str = item.ToString(); } //select template if (str == null) { return(DefaultTemplate); } if (String1 != null && String1.Split(',').Contains(str)) { return(Template1); } if (String2 != null && String2.Split(',').Contains(str)) { return(Template2); } if (String3 != null && String3.Split(',').Contains(str)) { return(Template3); } if (String4 != null && String4.Split(',').Contains(str)) { return(Template4); } if (String5 != null && String5.Split(',').Contains(str)) { return(Template5); } if (String6 != null && String6.Split(',').Contains(str)) { return(Template6); } if (String7 != null && String7.Split(',').Contains(str)) { return(Template7); } if (String8 != null && String8.Split(',').Contains(str)) { return(Template8); } if (String9 != null && String9.Split(',').Contains(str)) { return(Template9); } if (String10 != null && String10.Split(',').Contains(str)) { return(Template10); } return(DefaultTemplate); }
private string TrimString() { return(String1.Trim()); }
public override int GetHashCode() { int num = 1; if (EventType != 0) { num ^= EventType.GetHashCode(); } if (EventId != 0) { num ^= EventId.GetHashCode(); } if (parentEventId_.HasValue) { num ^= ParentEventId.GetHashCode(); } if (Int1 != 0) { num ^= Int1.GetHashCode(); } if (Int2 != 0) { num ^= Int2.GetHashCode(); } if (Int3 != 0) { num ^= Int3.GetHashCode(); } if (Int4 != 0) { num ^= Int4.GetHashCode(); } if (Int5 != 0) { num ^= Int5.GetHashCode(); } if (Int6 != 0) { num ^= Int6.GetHashCode(); } if (Int7 != 0) { num ^= Int7.GetHashCode(); } if (String1.Length != 0) { num ^= String1.GetHashCode(); } if (Bool1) { num ^= Bool1.GetHashCode(); } if (cellCoord1_ != null) { num ^= CellCoord1.GetHashCode(); } if (cellCoord2_ != null) { num ^= CellCoord2.GetHashCode(); } if (CompanionReserveState1 != 0) { num ^= CompanionReserveState1.GetHashCode(); } if (CompanionReserveState2 != 0) { num ^= CompanionReserveState2.GetHashCode(); } if (DamageReductionType1 != 0) { num ^= DamageReductionType1.GetHashCode(); } if (FightResult1 != 0) { num ^= FightResult1.GetHashCode(); } if (gameStatistics1_ != null) { num ^= GameStatistics1.GetHashCode(); } if (TeamsScoreModificationReason1 != 0) { num ^= TeamsScoreModificationReason1.GetHashCode(); } if (optInt1_.HasValue) { num ^= OptInt1.GetHashCode(); } if (optInt2_.HasValue) { num ^= OptInt2.GetHashCode(); } if (optInt3_.HasValue) { num ^= OptInt3.GetHashCode(); } if (optInt4_.HasValue) { num ^= OptInt4.GetHashCode(); } num ^= ((object)cellCoordList1_).GetHashCode(); num ^= ((object)spellMovementList1_).GetHashCode(); num ^= ((object)castTargetList1_).GetHashCode(); num ^= ((object)intList1_).GetHashCode(); num ^= ((object)intList2_).GetHashCode(); if (_unknownFields != null) { num ^= ((object)_unknownFields).GetHashCode(); } return(num); }
public override void Init(AstContext context, ParseTreeNode treeNode) { base.Init(context, treeNode); scenenumber = String1.str2varname(); }
/// <summary> /// 指示当前对象是否等于同一类型的另一个对象。 /// </summary> /// <param name="other">与此对象进行比较的对象。</param> /// <returns>如果当前对象等于 <paramref name="other"/> 参数,则为 true;否则为 false。</returns> public bool Equals(LevenshteinDistanceResult other) { return(String1.Equals(other.String1) && String2.Equals(other.String2)); }