Removing country code

  • Thread starter Thread starter Ramesh
  • Start date Start date
R

Ramesh

HI,

Any ideas on how I could remove the country code (+91) from the Mobile
number field entries? eg., +919843928488 to updated to 9843928488.

Also would be great if I can also check for the number of digits before
doing this operation.

Thanks for any help.

Ramesh
 
Ramesh,
With the plus sign, I would assume your TelNo field is string.
I'll also have to assume that all your TelNo entries that are 13
characters long have the +91 at the start of the string.

Use the Len Function to determine how many characters there are in the
String.
Len(TelNo) = 13
To drop the first 3 characters...
TelNo = Mid(TelNo,4)
so...
If Len(TelNo) = 13 Then
TelNo = Mid(TelNo,4)
End If
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Al,

For my own edification, if your assumptions hold true would Right(TelNo,10)
be easier?
 
nomadk,
There's no real difference between the two methods but... I usually
attack a string manipulation from the side operated on.
Remove left = Mid (how far from left)
Remove right = Right (how far from right)

Using Mid would also work even if my assumption of a fixed length string
was wrong.
The Mid would still work with "+9112345" or "+91123456789123456"
and
given the IF Length code is also suggested, the string operation should
be a bit safer.

But really... it's six of one and half a dozen of the other...
--
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top