Solved

Extract chars from a string

Posted on 2004-09-22
3
285 Views
Last Modified: 2010-05-02
Hi there,
I would like take out all the chars of a certain type from a string.

Eg.
Before process
suppliername23/05/04

take out all "/"

Result:
suppliername230504

I thought there was a string fuction to do this but can't seem to find it.

Any suggestions,
Williery10
0
Comment
Question by:williery10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:AbhishekSharma
ID: 12120525
Use spit function to retrive the values
Example:- "suppliername23/05/04"

a=split("suppliername23/05/04","/")

a is an array of type string

a(0) will return  suppliername23
a(0) will return  05
a(0) will return  04

The Split function returns a zero-based, one-dimensional array that contains a specified number of substrings.

Syntax
Split(expression[,delimiter[,count[,compare]]])
 
0
 
LVL 3

Expert Comment

by:thunder_moose
ID: 12120539
Hi there,

Not too hard... just pass your string to this function:

Function RemoveSlashes(StringToCheck As String) As String
   Dim TempStr As String
   Dim CurChr As Integer

   CurChr = 1
   Do Until CurChr - 1 = Len(StringToCheck)
        Select Case Mid(StringToCheck, CurChr, 1)
               Case "/"
                    TempStr = TempStr
               Case Else
                    TempStr = TempStr & Mid(StringToCheck, CurChr, 1)
        End Select
   CurChr = CurChr + 1
   Loop
   RemoveSlashes = TempStr
End Function

Hope that helps :)
tm
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 50 total points
ID: 12120664
Or even simpler:

   sValue = "suppliername23/05/04"
   sValue = Replace(sValue, "/", "")


Hope this helps.
0

Featured Post

Independent Software Vendors: 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

615 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