[Solved] Replace multiple substrings between delimiters in Java

From comment: but if I do not know the text between the delimiters? So it sounds like the replacement values are positional. Best way to do this is a regular expression appendReplacement loop: public static String replace(String input, String… values) { StringBuffer buf = new StringBuffer(); Matcher m = Pattern.compile(“\\|{2}(.*?)\\|{2}”).matcher(input); for (int i = 0; … Read more

[Solved] Unordered Random Numbers [closed]

if you want to generate random numbers in range without repeating, you can try this: public static List<int> GenerateNumbers(int mn,int mx) { List<int> source = new List<int>(); for (int i = mn; i <= mx; i++) source.Add(i); var random = new Random(); List<int> randomNumbers = new List<int>(); while(source.Count != 0) { int randomIndex = random.Next(source.Count); … Read more

[Solved] Class interface or enum expected – Error

Ciao Mario, I think you want an Android app able to do this. First of all you have Android Studio installed so in Android Studio click on File -> New -> New Project… and let’s create the project as shown here. Your project location will be different and it’s ok but if you don’t want … Read more

[Solved] Output of program unable to display correctly in Java [closed]

Its a basic integer divison problem Integer division: How do you produce a double? Either change int maxDays, days; to double maxDays, days; or change your calculate method from: attendancePercentage=(days/maxDays)*100; to: attendancePercentage = ((double) days / (double) maxDays) * 100;` solved Output of program unable to display correctly in Java [closed]

[Solved] C++ struct in a vector in an object(class)

The problem is that you define a type (account) in the class. account is a type so you should not declare it in the class : struct account { std::string name; float money; short pin; }; and then, the class becomes : class CBank { public: CBank(); account acc; std::vector<account> add; }; and the main … Read more

[Solved] Which phone has got high sales in each year?

In the derived table the total sales are calculated at ( year,phone ) combination. Once the total sales are calculated all the top rows( rank = 1 by sales ) should be identified for each year. By using correlated sub-queries and having clause the first row is identified from each group( year ) and displayed … Read more

[Solved] How to find the nth digit in a list in python

Lists work in an index form. So index[0] of a list is the first item. So to find the nth item in a list, your code would look something like this. list = [a, b, c, d, e, f, g] chosen_number = input(“Which number would you like from 1-7?”) print(“The item {} places into the … Read more

[Solved] Write xml with c#?

So if I get it correct, you want to append new data to your existing xml. For that you can chose to temporarily store the current xml and and add new data to it using Linq Xml. To do this, now you need to modify your current code with an additional check for xml file … Read more

[Solved] Background color on only text [closed]

.container { width: 300px; display: flex; } .left p, .right p { width: 100%; background: orange; color: white; display: inline; } .left { text-align: left; } .right { text-align: right; } .separator { background: white; width: 20px; } <div class=”container”> <div class=”left”><p>See details on dealer website</p></div> <div class=”separator”></div> <div class=”right”><p>See details on dealer website</p></div> </div> … Read more