I’d like to know how I could find a piece of data, in a very long, comma separated string, that has a leading zero. I’m using str_replace for a few things, like to remove "\r
" from the data like this:
$value = str_replace("\\r\
", "", $value);
Is there something I can use to find data with a leading zero and treat it?
I don’t see how I can check if the value is numeric, when the string is full of all kinds of data (names, addresses, dates)? Also, I don’t need to add zeros, the CSV creation doesn’t remove the zeros. It’s when the program is opened in Excel that they are stripped.
I need a way to search through a very long, comma separated string, and look for pieces of data that start with zero.
Thanks for the responses. I figured out that the issue is NOT with my export of the data to CSV. The leading zeros are only removed when the file is opened in Excel. This is an issue with Excel, and not with the data. So the workaround needs to happen in Excel when the file is opened.