2 Replies - 3381 Views - Last Post: 21 October 2008 - 06:06 AM Rate Topic: -----

#1 eddy1309  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 2
  • Joined: 14-October 08

Left/Right

Post icon  Posted 20 October 2008 - 01:59 AM

heya just wopndered if anyone could give me a quick bit of help as to how the LEFT,RIGHT and MID code works and what it does.
thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Left/Right

#2 Reverand Dave  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 3
  • View blog
  • Posts: 375
  • Joined: 27-July 08

Re: Left/Right

Posted 20 October 2008 - 05:46 AM

Left, right, and Mid are ways to sort through a line of string data to do certain things. The syntax for the basic commands are

Mid(string, start, length)

Left(string, length)

Right(string, Length)



Lets start with the mid command.

Say you have a word in a text box, but you only want the middle 3 letters. If the text box reads "World War 3" Then your text box has 11 characters. This includes text and spaces. so if you wanted the word war out of this box to appear in another box you would do something like this:
Dim Tx1, Tx2 as String

Tx1 = Text1.text
Tx2 = Mid(Tx1, 7, 3)

Text2.Text = Tx2




This would put the word War in your second textbox. The W in war is the 7th character in the string and it counts 3 characters from there and stops. So Tx2 = War.

Next we'll do left

The left command starts at the leftmost side of your data string and counts from there. So if you wanted the word World from the previously used phrase in the second textbox as in the previous example the syntx would be as follows:

Dim Tx1, Tx2 as String

Tx1 = Text1.text
Tx2 = Left(Tx1, 5)

Text2.Text = Tx2



This would add all 5 characters of the word World into your second string. Left automatically starts on character 1.

My baby son just woke up so i'll conclude by saying right works in the exact same way as left, but backwards.

Hope this helps.
Was This Post Helpful? 1
  • +
  • -

#3 akhileshbc  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 9
  • View blog
  • Posts: 179
  • Joined: 27-September 08

Re: Left/Right

Posted 21 October 2008 - 06:06 AM

Dave's help is good for that
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1