Hi, i got some problems with remove and split:
i have the outputs, as below:
{1 2} 3
How to remove the syimbol {} and split the 3 ?for example. it will become
1 2
3
anyone know? Please help me..
Hi, i got some problems with remove and split:
i have the outputs, as below:
{1 2} 3
How to remove the syimbol {} and split the 3 ?for example. it will become
1 2
3
anyone know? Please help me..
String original = "{1 2} 3";
String temp = original.Replace("{","").Replace("}","");
int pos = temp.LastIndexOf(' ');
String first = temp.Substring(0, pos);
String last = temp.Substring(pos+1);
This question has a remarkable likeness with http://www.daniweb.com/software-development/csharp/threads/356505
You are both from Pahang Malaysia.
Maybe you are sitting next to each other in class?
Thanks for help, may i ask how to add those value to sortedlist?
In this case, 1 2 is key and 3 is the value of the sortedlistbut 3 must be as double.
sortedlist.Add(?,? );
I am currently studied in UMT and doing my final year project, lol
sortedlist.Add(first, last);
Did you not read the post of Momerath?
Just fill in first and last(converted to double)
1 more question, how to convert last to double type? because my sortedlist is Dictionary<string,double>sortlist=new Dictionary<string,double>();
Thanks for all the helps, really appreciate it.
Excuse me, after I tried the codes, i found that the codes just can functioned for output {1 2} 3, let say, my output as below:
{1 2} 3
{1 2 6} 7
{1 3 4} 3
{1 5} 3
how to split?I want to split number after "}" because i want add the number as value into sortedlist and the numbers inside "{}" as keys in sortedlist.
Sorry if my question not clear.
Did you try the code you already had?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.