#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    17
    Rep Power
    0

    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)?
  2. #2
  3. Type Cast Exception
    Devshed Supreme Being (6500+ posts)

    Join Date
    Apr 2004
    Location
    OAKLAND CA | Adam's Point (Fairyland)
    Posts
    14,954
    Rep Power
    8617
    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
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    17
    Rep Power
    0
    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) ?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    23
    Rep Power
    0

    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

IMN logo majestic logo threadwatch logo seochat tools logo