[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need to remove zeros infront of Data

Posted on 2007-10-17
4
Medium Priority
?
321 Views
Last Modified: 2013-11-18
Hi, I am working with textfieldparser and at first it was giving this error "String or binary data would be truncated. The statement has been terminated." Then I increased that size of the fields and now I am getting some zeros infront of my data, I need to get rid of them.  Please show me an example of how to remove this zeros.

Thanks
0
Comment
Question by:vielkacarolina1239
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 20096309
"I am getting some zeros infront of my data, I need to get rid of them."

So you are dealing with strings then right?...and "textfieldparser" suggests you are using VB.Net 2005?

Use the String.TrimStart() method:

    Dim str As String = "0000043.12"
    str = str.TrimStart("0")
    Debug.Print(str)
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 20096362
In VB, VAL(AnyStringWithZeros) will return AnyStringWithZeros, without leading or trailing zeros.
0
 

Author Comment

by:vielkacarolina1239
ID: 20096388
Yes I am using vb.net 2005
0
 

Author Comment

by:vielkacarolina1239
ID: 20096444
Thanks this solved the problem.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question