Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have the following question: How could I save what is in a texbox with numbers, separated from each other by commas, which are entered by the user in an array (vector)? The maximum number of numbers that can be entered is 3, and separated by commas, since I need to make a cross product of vectors (Product point). In advance thanks for the help.
You can simply use "split" and it will create the array.
var arrayList = yourTexbox.Text.split(",");
Give textboxes name like txt[1], txt[2], txt[3] and receive that from backend as array which contains value of textbox1 in 1th index , textbox2 in 2nd index etc
Use Regex.Matches with a pattern that only matches sets of 3
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a big function that returns a list of objects. I basically need the results to be put in to a text file. The list contains objects of a class with attributes string Index and integer count. I would want it to be written in a textfile like:
Index : Count fe.
BOOK_FROM_STORE : 27
Anybody has some guidance?
Parse the data held by your object to string and then write it to a text file.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
For Example I have String like this:
""dear customer{Customer name} your reference number is {referenceNumber}"
I want to get array=["{Customer name}",{referenceNumber}]"
I have to split based on curly bracket inside bracket value is changeable means it can be different for different cases I just need to split and get array of value inside brackets including brackets.
If you think about it, splitting on { and } will produce an array where every odd index is what you want..
.Split('{','}').Where((s,i)=>i%2==1).Select(s=>'{' + s + '}').ToArray();
Split the string, use the LINQ Where function that passes the int index to the predicate, insist that the index be odd (mod2 is 1) and select a new string that puts the brackets back on, ToArray
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a website dropdown that is populated from a SQL query. The values in the dropdown are from a table column and are like:
ABC-0123
ABC-0124
ABC-0125
ABC-0126.01
ABC-0126.02
ABC-0127
DEF-0123
DEF-0124
DEF-0125.1.01
DEF-0125.1.02
DEF-0125.2
I have a button to generate a new number based on what is selected in the dropdown. For example, if ABC-0125 is selected, ABC-0128 would need to be created since it's the next number in sequence. If ABC-0126.01 is selected, ABC-0126.03 would need to be created.
I'm looking for ideas on how to perform this. I considered just using the dropdown or querying the database directly.
I've split the selected value as a start:
String strDocFamily = drpDocFamily.SelectedValue;
string[] strDocTiers = strDocFamily.Split('.');
This may be open ended, but I'm looking for some suggestions on how to proceed. Thank you.
A solution might be to split the storage of the data into two or more columns, one for the alphabetic part ('ABC') another for the 'family' (0128 - the first set of digits) and others for the other tiers. You could then directly look up the maximum value of the 'family' column based on alphabetic. For example:
SELECT MAX(family-number)
FROM table-name
WHERE alpha-part='ABC';
Here is a UniqueID generator that can be easily adapted to generate a similar sequence to the one you need.
https://stackoverflow.com/a/39312025/2495728
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What is the regex for matching a date starting at the 4th position? I want it to return just the date and not the whole match. This is what I have.
^.{4}[2-9][0-9]{3}[0-1][0-9][0-9]{2}
DCSG20170406090204-FQI-046.TOT 04-FIC-046 00060Y000815050.562500G
DCS120170406090204-FQI-045.TOT 04-FIC-045 00060Y000878279.312500G
DCS120170406090204-FQI-046.TOT 04-FIC-046 00060Y000815050.562500G
http://regexr.com/3g0d5
You probably want a non-capturing group:
^(?:.{4})([2-9][0-9]{3}[0-1][0-9][0-9]{2})(?:.*)$
(mouse over the text at: http://regexr.com/3g0db and it will show just one group)
I don't know C#, but from my Perl perspective, I don't see any need for a regular expression. If you just want "the date" and don't need to validate it or separate it into components, just get the substring starting at position 4 (0 based) and 8 characters long.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I don't understand what is wrong i did the same code with the insert and run well
Entity obj = new Entity();
.
.
.
obj.DEPID = decimal.Parse(((TextBox)GridView1.FooterRow.FindControl("txtDEPID")).Text);
myFactory.UpdateObject(obj);
The value that is returned by the
((TextBox)GridView1.FooterRow.FindControl("txtDEPID")).Text
Is not a decimal-like string. It contains some other Special Characters like alphabets etc.
While passing the values, you need to make sure that the values being passed match the values required. Check what is the value of this.
txtDEPID.Text;
Use it in a MessageBox, to check for the value. I'm sure there is some sort of non decimal part in the string. Which is causing the trouble while converting the String to Decimal.
MessageBox.Show(txtDEPID.Text);