November 21st, 2011, 04:17 AM
-
Is it possible to exclude characters?
Hi,
Im working at a project atm where I need two different meanings from a clist.checked.items
For the listbox I need it to say "a001 terrengsykkel', and that works well enough.
Due to updating the database (phpsql) I need it to be only "a001" is it possible to exclude characters from 5 to 18?
Im new at this so I don't know, but something like this:
clist.checked.items(exclude char 5-18)?
November 21st, 2011, 12:37 PM
-
In this case just use Left() which works like a SubStr(1,n) - you can also use Mid() which is more like SubStr, either works.
strListEntry = Left(MyValue, 4)
or
strListEntry = Mid(MyValue, 1, 4)
medialint.com
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
November 22nd, 2011, 03:33 AM
-
Originally Posted by medialint
In this case just use Left() which works like a SubStr(1,n) - you can also use Mid() which is more like SubStr, either works.
strListEntry = Left(MyValue, 4)
or
strListEntry = Mid(MyValue, 1, 4)
Not really sure how to use it?
Im getting the info from a checklistbox called clistterreng, would it be something like strClistterrengEntry = Left(MyValue, 4) ?
December 7th, 2011, 03:28 PM
-
use left function
Originally Posted by oyb1n
Hi,
Im working at a project atm where I need two different meanings from a clist.checked.items
For the listbox I need it to say "a001 terrengsykkel', and that works well enough.
Due to updating the database (phpsql) I need it to be only "a001" is it possible to exclude characters from 5 to 18?
Im new at this so I don't know, but something like this:
clist.checked.items(exclude char 5-18)?
like the others i think the obvious answer is the left function
it is from a family of functions called the string manipulation functions
they mess with strings, they have a number of different syntaxes in the various languages we use but they basically return what you expect.
left or left$ takes a string in and passes a string of some length out ... like left("hello mum",4) would return the string "hell" like wise right or right$ takes a string and returns a string of some length...like right$("hello mum",3) returns the string "mum" and mid or mid$ takes a string at some starting position within it and returns a string of some length... like mid$("hello mum",4,6") returns the string "lo mum" note if you ask for more string than there is you will onlt get what is available so... mid4("hello mum",4,100) will still result in the string "lo mum".
in you situation simply call the appropriate string function acting on the container that holds the string and pass the returned string to your desired container.
so updatevale=left$(listbox(listindex),4) where the listindex identifies the position in the list where the data is to taken from.
hope that helped
bill stewart - here to talk