Re: How to remove quotes, commas, from numbers (considered as strings)?
- From: "marss" <marss@xxxxxxx>
- Date: 25 Dec 2006 07:37:45 -0800
sherifffruitfly wrote:
Example csv line:
43.56,345.2,"1,285,100",45.6
I would like to replace the quoted-comma'd numbers with their
unquoted-uncomma'd versions. I'm reading the csv line-by-line, putting
Another way to achieve the goal is using of MatchEvaluator.
ASP.Net 2.0
string pattern = "\"([0-9.,]+)\"";
string testStr = "43.56,345.2,\"1,285,100\",45.6";
MatchEvaluator eval = delegate (Match match)
{
return match.Groups[1].Value.Replace(",","");
};
testStr = new Regex(pattern).Replace(testStr, eval);
ASP.Net 1.1
void foo()
{
string pattern = "\"([0-9.,]+)\"";
string testStr = "43.56,345.2,\"1,285,100\",45.6";
testStr = new Regex(pattern).Replace(testStr, new
MatchEvaluator(eval));
}
static string eval(Match match)
{
return match.Groups[1].Value.Replace(",", "");
}
.
- Follow-Ups:
- Re: How to remove quotes, commas, from numbers (considered as strings)?
- From: sherifffruitfly
- Re: How to remove quotes, commas, from numbers (considered as strings)?
- References:
- How to remove quotes, commas, from numbers (considered as strings)?
- From: sherifffruitfly
- How to remove quotes, commas, from numbers (considered as strings)?
- Prev by Date: Re: Memory Limit for Visual Studio 2005???
- Next by Date: Re: check a user password
- Previous by thread: Re: How to remove quotes, commas, from numbers (considered as strings)?
- Next by thread: Re: How to remove quotes, commas, from numbers (considered as strings)?
- Index(es):
Relevant Pages
|