Question

Locked

How to extract numbers from the middle of a string of numbers ?

By twitter102010 ·
I have a string of 19 digits but when I enter the 19 digits into a form in access I want the field to display only the 9 digits located in the middle of the string which means that the nine digits are bound by 7 digits on the left and 2 digits on the right.
I think I need a VB code in order to make this work.
Any help will be appreciated.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

One typical solution

by trsbrn In reply to How to extract numbers fr ...

One solution is to write a routine to parse the string and convert it to an array of integers.

I don't know of any inbuilt functions that will do that for you.

Collapse -

Use a mid statement

by Slayer_ In reply to How to extract numbers fr ...

[pre]
Dim sTemp as string
sTemp=mid(InputString,7,9)
[/pre]
InputString is your 19 digit code, stemp will get the 9 digits you want

Mid statement is like this
mid(String to read,starting character, [length]) as string
Length is optional, if you omit length, the remainder of the string is used.

In .net, I believe the command is StringVariable.SubString

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums