Skip values from a list wrapped within quotation marks

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Skip values from a list wrapped within quotation marks



I've written a macro to get the individual value from a list. My intention is to skip those values wrapped with quotation marks. How can I do so?



I've written so far:


Sub dosth()
Dim post As Variant

For Each post In [{"1","'2'","3","'4'"}]
Debug.Print post
Next post
End Sub



Result it produces:


1
'2'
3
'4'



What I wish to have:


1
3



Can't find any idea to apply any conditional logic here. How can I achieve that?




1 Answer
1



Use a test of the ascii value. 39 is '.


'


Option Explicit

Sub dosth()
Dim elements As Variant, post As Variant
elements = [{"1","'2'","3","'4'"}]
For Each post In elements
If AscW(post) <> 39 Then Debug.Print post
Next post
End Sub



Similar idea


Option Explicit
Sub dosth()
Dim elements As Variant, post As Variant
elements = [{"1","'2'","3","'4'"}]
For Each post In elements
If Not Left$(post, 1) = Chr$(39) Then Debug.Print post
Next post
End Sub





You are incredible. Accept it when time is right. Btw, what is " connected to?
– asmitu
5 mins ago


"





you want to know what the code is for that? " is chr$(34)
– QHarr
3 mins ago







Yep it is. Still five minutes to accept.
– asmitu
1 min ago






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.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP