1 Replies - 364 Views - Last Post: 07 September 2009 - 08:25 PM Rate Topic: -----

#1 juniorpop  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-August 09

Addressing variable within another variable

Posted 07 September 2009 - 08:07 PM

Hey guys I'm trying to do something like this

dim x as string
dim y1 as string
dim y2 as string
dim z as string

y1= x & z
y2 = z & x
if (x in y1) equals (x in y2) then
'some commands
endif

What are the available commands for (x in y1) equals (x in y2)?
I tried 'in' but I don't know how to use it and google won't display accurate search results.
Would appreciate anybody's help, thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Addressing variable within another variable

#2 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: Addressing variable within another variable

Posted 07 September 2009 - 08:25 PM

Are you thinking:
If y1.Contains(x) And y2.Contains(x) Then
...
End If


Equals doesn't make any sense in your context... Once you do the line "y1 = x & z", VB makes a completely new string that is x concatenated with z. There is no concept of the original string objects in the new string object, it is take the data from each of the objects and generate a completely new object.

Open the VB Help, Index and look under String class, All Members and read the possibilities available to you - Google is better for samples once you have an idea of what you are trying to do.

This post has been edited by mark.bottomley: 07 September 2009 - 08:28 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1