PHP, get file name without file extension

I have this PHP code: function ShowFileExtension($filepath) { preg_match(‘/[^?]*/’, $filepath, $matches); $string = $matches[0]; $pattern = preg_split(‘/\./’, $string, -1, PREG_SPLIT_OFFSET_CAPTURE); if(count($pattern) > 1) { $filenamepart = $pattern[count($pattern)-1][0]; preg_match(‘/[^?]*/’, $filenamepart, $matches); return strtolower($matches[0]); } } If I have a file named my.zip, this function returns .zip. I want to do the reverse, I want the function … Read more

Writing data into CSV file in C#

I am trying to write into a csv file row by row using C# language. Here is my function string first = reader[0].ToString(); string second=image.ToString(); string csv = string.Format(“{0},{1}\n”, first, second); File.WriteAllText(filePath, csv); The whole function runs inside a loop, and every row should be written to the csv file. In my case, next row … Read more