[Solved] How do i check if my string contains certain words

It should work like that <button onclick=”myFunction()”>navigate</button> <script> function myFunction() { var url = document.URL; if (window.location.href.indexOf(‘brand’) > -1) { alert(‘yes’); } url = url.replace(‘.html’,’.php’) window.location.href = url; } </script> solved How do i check if my string contains certain words

[Solved] Why iisn’t my function working when it’s called? [closed]

int hitDaEnterKey() { INPUT ip; // Set up a generic keyboard event. ip.type = INPUT_KEYBOARD; ip.ki.wScan = 0; // hardware scan code for key ip.ki.time = 0; ip.ki.dwExtraInfo = 0; // Press and release Enter Key ip.ki.wVk = 0x0D; ip.ki.dwFlags = 0; SendInput(1, &ip, sizeof(INPUT)); // release ip.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &ip, sizeof(INPUT)); return 0; … Read more

[Solved] Regex condition in C#

As you further explained that you actually do want to match any letter at the beginning, and any two digits at the end of the string, using a regular expression is indeed the shortest way to solve this. Regex re = new Regex(“^[a-z].*[0-9]{2}$”, RegexOptions.IgnoreCase); Console.WriteLine(re.IsMatch(“Apple02”)); // true Console.WriteLine(re.IsMatch(“Arrow”)); // false Console.WriteLine(re.IsMatch(“45Alty12”)); // false Console.WriteLine(re.IsMatch(“Basci98”)); // … Read more

[Solved] How to multiply each element in an array with a different number (javascript) [closed]

Fixed number for all index var array = [0, 1, 2, 3]; array.map( function(n){ return (n* number to be multiplied); } ); Different number for each index var array = [0, 1, 2, 3], numberToBeMultiplied = [1,3,5,7]; array.map( function(n, i){ return n * numberToBeMultiplied[i]; }); You can also push the returning elements in an array. … Read more

[Solved] Str object has no attribute “add”

You assigned a string to the operator name: operator = randomOp[0] You are now masking the operator module. Don’t re-use names like that, because the next iteration of your for loop operator.add now tries to look up the add attribute on that string (so one of ‘+’, ‘-‘ or ‘*’, whatever the first iteration picked … Read more

[Solved] How to convert a number into two numbers in the scientific notation?

use this Method to determine your string public static string ConvertExp(int Value) { int exp = Math.Abs(Value).ToString().Length -1; return string.Format(“{0} * 10^{1}”,( Value / Math.Pow(10 , exp)), exp); } and to get 2 values public static double[] ConvertExp(int Value) { int exp = Math.Abs(Value).ToString().Length -1; return new double[] { Value / Math.Pow(10, exp), Math.Pow(10, exp) … Read more

[Solved] Sort a string so I can use it with LINQ

If you are going to be dealing with these objects often then I would definitely make classes to represent them to make it easier to deserialize the JSON strings. If not then you can just roll something quick and dirty. Either way I think you are going to want to use the Json.NET library; it … Read more