[Solved] Try to convert text file to Excel [closed]

Try following code : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication87 { class Program { const string FILENAME = @”c:\temp\test.txt”; static void Main(string[] args) { Item items = new Item(FILENAME); } } public class Item { public static List<Item> items = new List<Item>(); public string VehicleReferenceKey; public string DriverReferenceKey; public … Read more

[Solved] rearding regex (python) [closed]

Here: http://rubular.com/r/CCW7sAUMrs is an example regex that matches whole text within {{ }}. You can easily clean up Your string with it using re.sub. Note, that it will not work when You have text like {{test}} paragraph {{test}}, because it will match whole string. As larsmans said, it gets harder if You can nest braces. … Read more

[Solved] How to do the c# string.split() in oracle

Replace the prefixes you want to remove, then find the index of the first and second underscores and then find the substring between those two separators: Oracle Setup: CREATE TABLE your_table ( value ) AS SELECT ‘DUM_EI_AO_L_5864_Al Meena Tower’ FROM DUAL UNION ALL SELECT ‘EI_AE_L_5864_Al radha Tower’ FROM DUAL Query: SELECT value, SUBSTR( replaced_value, first_separator … Read more

[Solved] How to replace specific part of a string (replace() dosen’t help…) [closed]

I just got a trick for you to achieving what you want. a = “hello world, hello there, hello python” a = a.replace(“hello”,”hi”,2).replace(“hi”,”hello”,1) print(a) So what exactly 2nd Line does it it is replacing first two occurrence of hello to hi and then replacing 1st occurrence of hi to hello. Thus getting the output you … Read more

[Solved] How to achieve this feature [closed]

I made this one: https://snack.expo.io/H1rGEMRAr I used ‘state’ to control what was inside of emptyCircles constructor(props) { super(props); this.state = { emptyCircles: [{ image: placeholder, },{ image: placeholder, },{ image: placeholder, },{ image: placeholder, }] }; this.clearEmptyCircles = this.clearEmptyCircles.bind(this); this.addCircle = this.addCircle.bind(this); } And wrote some functions to update that state: clearEmptyCircles() { this.setState({emptyCircles: [{ … Read more

[Solved] How to capitalize first occurrence of each character in a string

I would do it this way (since I love java streams) public static String capitalizeFirstOccurrence(String str) { var alreadyOccurred = new HashSet<String>(); return str.chars() .mapToObj(x -> String.valueOf((char) x)) // convert to single char String .map(character -> { if (alreadyOccurred.contains(character)) { return character; } alreadyOccurred.add(character); return character.toUpperCase(); }) .collect(Collectors.joining()); } public static void main(String[] args) { … Read more

[Solved] C# Something messed up with this function spilt() [closed]

You are using Split to split your main string on multiple different values, you could probably still retrieve the value you want, but using a different index. Instead of trying to split your main string with both strings at once like your current code: mainstring.Split(new[] { “{CODE_5:”, “}” }, StringSplitOptions.None)[1]; try splitting it up, into … Read more

[Solved] Generic class with type as pointer to object of another class – NOT WORKING [closed]

Your code should compile if you: choose one of class/struct in types and one of class/typename in template parameters use semicolons after class or struct definitions write > > instead of >> in nested templates (pre C++11) 5 solved Generic class with type as pointer to object of another class – NOT WORKING [closed]

[Solved] How do I parse and split data in single quotation mark using Java?

Try using Pattern and Matcher classes from java.util.regex package. Something like this : String data = “[‘first data’,’second data’, ‘third data’]”; Pattern pattern = Pattern.compile(“‘(.*?)'”); Matcher matcher = pattern.matcher(data); while (matcher.find()) { System.out.println(matcher.group(1)); } Output: first data second data third data solved How do I parse and split data in single quotation mark using Java?

[Solved] Calculate variable based on criteria in r

Plyr solution: library(plyr) ddply(df,.(ID),transform,AGE_HEAD=head(AGE,1)) OR ddply(df,.(ID),transform,AGE_HEAD=AGE[PERNO==1]) ID AGE PERNO AGE_HEAD 1 1 30 1 30 2 1 25 2 30 3 2 25 1 25 4 2 24 2 25 5 2 3 3 25 6 3 65 1 65 7 3 55 2 65 data.table solution: library(data.table) DT<-data.table(df) DT[, AGE_HEAD := AGE[PERNO==1], by=”ID”] ID … Read more