배열로 CSV 파일을 구문 분석합니다. 배열의 한 요소는 내가 0으로이 문제를 분석하고 싶지만 내가 시도 때 1구문 분석 .0000 ~ 0 C#
fields[38].Substring(0,fields[38].IndexOf(".")) // expected 0, return 1
Convert.ToDecimal(fields[38]) // expected 0.00, return Exception
string.Equals(fields[38],".0000") // expected true, return false
(int)decimal.Parse(fields[38]) // expected 0, return 1
을 반환 다음과 같은 방법을 사용하여 0.0000을 구문 분석 0.0000입니다 제발 도와주세요 !!!!!!!! 쉬운 방법이 있다면
당신이이 칼럼에서 찾을 것으로 예상되는 다른 값의 몇 가지의 예를 추가 할 수 있습니다 (필드 [38]) ? –
@ArunKumar, 샘플 코드를 "string testValue ="some text "; Convert.ToDecimal (testValue) // expected 0, return 1"과 같이 작성하십시오. –
@DanielBallinger : Tim Schmelter의 답변 감사합니다. – KillerGearz