Skip to main content

All Questions

Tagged with
2 votes
3 answers
100 views

Find occurrence of YYYYmmDD date in variable string

Suppose I have a string containing dates in YYYYmmDD format but in variable position and containing also other numeric sequences For example: xx12x20240113yyyy123zzzz 20240201xxxx34yyy ...
user24145613's user avatar
-3 votes
2 answers
186 views

Merge 2 Numeric strings Alternatively every Nth place [closed]

I have 2 Numeric strings with commas: 8,1,6,3,16,9,14,11,24,17,22,19 and 2,7,4,5,10,15,12,13,18,23,20,21 and I need to merge them Alternatively every Nth place (for Example every 4th place to get) 8,1,...
EdV's user avatar
  • 55
0 votes
0 answers
30 views

Extract number from string with C# Regex [duplicate]

I want to extract a number from a string in C#. The input string is a single line, but otherwise can be anything. I want to extract with the following rules: The first character can be a minus sign, ...
Rob Cunningham's user avatar
0 votes
2 answers
718 views

Apply multiple numeric formatting simultaneously, C#

Is it possible to apply multiple formatting simultaneously to a double? For example, I want something like this double d = 1234.567; string format = ? // sig digit 4 , digit after decimal 4 , ...
shams.arifin's user avatar
1 vote
1 answer
594 views

string to double validation c# please answer

ok so I am building a program in WPF format. as you know wpf's inputs are usually string, to turn those into double first I need to validate if those string fit and then to proceed and convert them. ...
DavidS47's user avatar
33 votes
6 answers
45k views

Keep only numeric value from a string?

I have some strings like this string phoneNumber = "(914) 395-1430"; I would like to strip out the parethenses and the dash, in other word just keep the numeric values. So the output could look like ...
meda's user avatar
  • 45.5k
0 votes
2 answers
552 views

How to replace a numeric character with empty character in C#?

I have string like 1 69 / EMP1094467 EMP1094467 : 2 69 / ScreenLysP here the numeric characters should be replace with empty characters, Llike: / EMP1094467 I tried like this var output = ...
Pallavi's user avatar
  • 87
0 votes
2 answers
137 views

C# Converting/Splitting a String with numeric and letters

I tried to split a String into a parts array and combine them at the end into a result String. But while I tested a little bit, I get a message. By pressing convert_click: "NullRefenceException was ...
Knolle's user avatar
  • 1
3 votes
3 answers
471 views

Expanding numeric string into individual numbers

I'm working on a WinForms app that accepts numeric strings as an input. If my user is entering a contiguous range of numbers, he/she may represent that range using a shorthand notation like this: 12[...
bmt22033's user avatar
  • 7,260
-2 votes
1 answer
295 views

Is there a away to check if one nvarchar is less than the other? [closed]

I have two values that are string but they hold numeric data. I would use convert.toint32 however I am passing a string through to the database and therefore will cause confliction (returning the ...
user1099719's user avatar
-1 votes
4 answers
5k views

How to check if string is only Numeric and AlphaNumeric and not character string? [closed]

I have a sample data in where have to determine whether the string is numeric or alpha numeric but not a simple character string. for ex: my data is: 123XY 12346 WEPXY What is the condition that ...
user1061293's user avatar
2 votes
4 answers
267 views

Using '.ToString()' with numeric variables

Is there any drawback for omitting .ToString() while converting numeric values to string ? int i = 1234; string s; // Instead of s = "i is " + i.ToString(); // Writing s = "i is " + i;
Xaqron's user avatar
  • 30.9k
7 votes
2 answers
2k views

Is there a simple method of converting an ordinal numeric string to its matching numeric value?

Does anyone know of a method to convert words like "first", "tenth" and "one hundredth" to their numeric equivalent? Samples: "first" -> 1, "second" -> 2, "tenth" -> 10, "hundredth" -> 100 Any ...
soutarm's user avatar
  • 841
0 votes
7 answers
2k views

Good way to translate numeric to string, with decimal point removed?

I have to deal with a numeric value (coming from a SQL Server 2005 numeric column) which I need to convert to a string, with the caveat that the decimal point has to be removed. The data itself is ...
larryq's user avatar
  • 16.3k
124 votes
13 answers
227k views

Evaluating string "3*(4+2)" yield int 18 [duplicate]

Is there a function the .NET framework that can evaluate a numeric expression contained in a string and return the result? F.e.: string mystring = "3*(2+4)"; int result = EvaluateExpression(mystring);...
sindre j's user avatar
  • 4,444