I have this text
"\This is a report 12000.csv\"
I want the text before the period, ie 12000
.
Is there a something similar to a SubString and CharIndex that's available in SQL Server? Or some other easy method?
I have this text
"\This is a report 12000.csv\"
I want the text before the period, ie 12000
.
Is there a something similar to a SubString and CharIndex that's available in SQL Server? Or some other easy method?
This task achieved by using regular expressions. The code below will extract any number from provided string
var yourString = @"\This is a report 12000.csv\";
var foundNum = Regex.Match(yourString, @"\d+").Value;
Console.Write(foundNum);
//output 12000
var yourString1 = @"\This is a 8080 report .csv\";
var foundNum1 = Regex.Match(yourString1, @"\d+").Value;
Console.WriteLine(foundNum1);
//output 8080