lowercase string input

I was wondering if there was any way to convert input from a string variable so that lowercase letters would become upper case. For example if the input is ao89765 it would be converted to AO89765. My data(a huge amount of it) is all uppercase and the search doeasn't work if the input variable contains lower case letters. Being able to convert it would save me from having double the data I have now. I use Qbasic 7.1 if that means anything. Thanks for your help.

Comments

  • While I don't have the reference handy at this moment, I believe what you want to use is the UPPER$() function. It converts all lower case letters to upper case in the target string.

    Usage:

    newUppercaseText$ = UPPER$(targetText$)

    and conversely:

    newLowercaseText$ = LOWER$(targetText$)

  • : Sorry, my error... the function is called UCASE$()
    :
    : Usage:
    :
    : newUppercaseText$ = UCASE$(targetText$)
    :
    : and conversely:
    :
    : newLowercaseText$ = LCASE$(targetText$)
    :
    :

  • Worked perfectly, thanks a lot.
  • [b][red]This message was edited by the detj at 2002-3-23 11:24:33[/red][/b][hr]
    : I was wondering if there was any way to convert input from a string variable so that lowercase letters would become upper case. For example if the input is ao89765 it would be converted to AO89765. My data(a huge amount of it) is all uppercase and the search doeasn't work if the input variable contains lower case letters. Being able to convert it would save me from having double the data I have now. I use Qbasic 7.1 if that means anything. Thanks for your help.
    :

    There is no problem in converting uppercase to lowercase or vice versa, when you are using Qb 7.1. Qbasic provides UCASE$ and LCASE$ functions just to change them.
    for example:

    input "Enter name: ";n$ 'suppose this is the input variable
    n$=UCASE$(n$) 'this would convert everything to capitals
    print n$ 'now you can do anything with n$
    end

    You can modify this source as per your needs.





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories