check letters (or numbers) inside of a string

Discussion in 'AutoCAD' started by Mikko, Jul 25, 2003.

  1. Mikko

    Mikko Guest

    Hello

    Here's the problem. I have these uons read from attributes in a drawing. The
    value of the attribute should be something like 2345434, the amount of
    numbers varies. The format of uons is string. Anyway my code has worked
    perfectly... until now. I just noticed that if the value of uons is for
    example VJH.80 an error is generated. This happens because the type of
    uon_appl in database is number. So if I pass letters to sql statement it
    causes an error.

    How can I check the uons so that I go through every letter individually and
    if it is not number I wont perform the sql sentence. Or if you have some
    other solution for this I'd like to see that.

    The first problem is that I can't convert uons to integer cause i have to
    use strcat (or is there some other way I could do that same thing?)

    The other one is that I don't want to use "like" statement instead of "="
    (which would make the program work) because the program gets really slow
    with "like" statement.

    Here are the two lines that are causing problems:

    (setq uons (cdr (assoc 1 ed2)))
    (setq finds (caar (sqlexe (strcat "SELECT uon_appl FROM elina_application
    WHERE uon_appl = '"uons"'"))))
     
    Mikko, Jul 25, 2003
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.