VB.NET check range of cells in excel whether data length is less then 7, add “wwww” to the left until it becomes 7 characters
VB.NET check range of cells in excel whether data length is less then 7, add “wwww” to the left until it becomes 7 characters
i was wondering if is there any vb.net function that loop through excel file and check for the data length under a specific column?
i've got a column where the data shouldn't be less than 7 characters
any help would be appreciated :)
1 Answer
1
There are countless examples of getting excel data, so this answer is just for the padding.
You can use String.PadLeft
using the overload that supplies length and the character to pad with.
String.PadLeft
Dim yourString = "test"
yourString = yourString.PadLeft(7,"w")
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please show what you have tried so far: No attempt was made.
– Pᴇʜ
Jun 29 at 11:07