Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Re: finding parts of a word. (insidea textbox)

Expand Messages
  • matt
    Sorry, you can disregard the question in my last email... i used this. -- prompt text... ; INP$ FOR I = 1 to LEN(INP$) if ASC(MID$(INP$,I,1)) = a then print
    Message 1 of 27 , Aug 31, 2005
    • 0 Attachment
      Sorry, you can disregard the question in my last email...

      i used this.

      --
      prompt "text..."; INP$

      FOR I = 1 to LEN(INP$)
      if ASC(MID$(INP$,I,1)) = a then print "12252"
      if ASC(MID$(INP$,I,1)) = b then print "12243"
      'ect...
      NEXT I

      --

      ~Matt

      Thanks ALOT!
    • ralph_iden_fsc
      Glad to hear that you got things worked out, Matt. Good luck with your programming!
      Message 2 of 27 , Aug 31, 2005
      • 0 Attachment
        Glad to hear that you got things worked out, Matt. Good luck with
        your programming!
      • matt
        Wait, now i remember something wasent working, and i will send another email, explaining it. i fegot what was heppening now :( ~Matt
        Message 3 of 27 , Sep 1, 2005
        • 0 Attachment
          Wait, now i remember something wasent working, and i will send another
          email, explaining it. i fegot what was heppening now :(

          ~Matt
        • matt
          When i type more than one Chair into the prompt window, it dosent work. It works with just one though. Here is the code. prompt ... ; INP$ FOR I = 1 to
          Message 4 of 27 , Sep 1, 2005
          • 0 Attachment
            When i type more than one Chair into the prompt window, it dosent work.
            It works with just one though. Here is the code.

            prompt "..."; INP$
            FOR I = 1 to LEN(INP$)
            if ASC(MID$(INP$,I,1)) = a then print "12252"
            if ASC(MID$(INP$,I,1)) = b then print "12243"
            if ASC(MID$(INP$,I,1)) = c then print "12345"
            NEXT I



            ~Matt

            hope you can help.
          • Chergarj@cs.com
            Are you saying Chair or character? The prompt command requires an input variable: ONE INPUT VARIABLE. The length of the information you input is not
            Message 5 of 27 , Sep 1, 2005
            • 0 Attachment
              Are you saying "Chair" or "character?"
              The prompt command requires an input variable: ONE INPUT VARIABLE. The
              length of the information you input is not important. The user should supply input
              of at least one character. Other tests and manipulations can be performed on
              the input information.

              G C

              In a message dated 09/01/2005 5:10:09 PM Pacific Daylight Time,
              mge@... writes:
              > When i type more than one Chair into the prompt window, it dosent work.
              > It works with just one though. Here is the code.
              >
              > prompt "..."; INP$
              > FOR I = 1 to LEN(INP$)
              > if ASC(MID$(INP$,I,1)) = a then print "12252"
              > if ASC(MID$(INP$,I,1)) = b then print "12243"
              > if ASC(MID$(INP$,I,1)) = c then print "12345"
              > NEXT I
              >
              >
              >
              > ~Matt
              >
              > hope you can help.


              [Non-text portions of this message have been removed]
            • Chergarj@cs.com
              In a message dated 09/01/2005 5:10:09 PM Pacific Daylight Time, ... NOTE CAREFULLY WHAT YOUR LOOP DOES! Your decisions are checking exactly a length of ONE
              Message 6 of 27 , Sep 1, 2005
              • 0 Attachment
                In a message dated 09/01/2005 5:10:09 PM Pacific Daylight Time,
                mge@... writes:
                > prompt "..."; INP$
                > FOR I = 1 to LEN(INP$)
                > if ASC(MID$(INP$,I,1)) = a then print "12252"
                > if ASC(MID$(INP$,I,1)) = b then print "12243"
                > if ASC(MID$(INP$,I,1)) = c then print "12345"
                > NEXT I
                >

                NOTE CAREFULLY WHAT YOUR LOOP DOES!
                Your decisions are checking exactly a length of ONE character size. You have
                specified this in your MID$() functions. It seems designed to check the
                whole string character by character. Maybe I'm confused about the ASC() function,
                so I'm going to recheck again.

                G C


                [Non-text portions of this message have been removed]
              • Chergarj@cs.com
                Maybe THIS is what you want: ******************************************** prompt ... ; INP$ FOR I = 1 to LEN(INP$) if (MID$(INP$,I,1)) = a then print
                Message 7 of 27 , Sep 1, 2005
                • 0 Attachment
                  Maybe THIS is what you want:

                  ' ********************************************
                  prompt "..."; INP$
                  FOR I = 1 to LEN(INP$)
                  if (MID$(INP$,I,1)) = "a" then print "12252"
                  if (MID$(INP$,I,1)) = "b" then print "12243"
                  if (MID$(INP$,I,1)) = "c" then print "12345"
                  NEXT I

                  ' ********************************************

                  G C


                  [Non-text portions of this message have been removed]
                • matt
                  Yes, that is EXACTLY what i mean. sorry about my abrivations, chair (character) i can be confuseing. i am sick at the moment, and still have to go to school.
                  Message 8 of 27 , Sep 1, 2005
                  • 0 Attachment
                    Yes, that is EXACTLY what i mean. sorry about my abrivations, chair
                    (character) i can be confuseing.

                    i am sick at the moment, and still have to go to school. but anayway,
                    the code you provided works fine :)

                    most of my programs are generated by you, and other helpfull members of
                    the yahoogroup :(

                    Thankyou everyone who contributed :) it was helpfull.

                    ~Matt
                  • Chergarj@cs.com
                    In a message dated 09/01/2005 7:52:35 PM Pacific Daylight Time, ... Most of my programs in the far past were generated by course exercises; later, nearly all
                    Message 9 of 27 , Sep 1, 2005
                    • 0 Attachment
                      In a message dated 09/01/2005 7:52:35 PM Pacific Daylight Time,
                      mge@... writes:
                      > most of my programs are generated by you, and other helpfull members of
                      > the yahoogroup :(
                      >

                      Most of my programs in the far past were generated by course exercises;
                      later, nearly all of my programs have been generated by restudy and by influential
                      experiences stimulating me to look for software solutions to routine problems
                      which came from employment situations. In about 2 or 3 days you will feel
                      better (assuming nothing more than common viral infection) and you'll be back to
                      continue exercise studies in BASIC. A person should have some fundamental
                      study, and then real life experience, and then he could generate some of his own
                      programming projects. To rush this process is difficult.

                      G C


                      [Non-text portions of this message have been removed]
                    • matt
                      how would i get the program to do this?? it thinks that the is the end of the variable. if (MID$(INP$,I,1)) = then print quote this is the only
                      Message 10 of 27 , Sep 2, 2005
                      • 0 Attachment
                        how would i get the program to do this?? it thinks that the " is the
                        end of the variable.

                        if (MID$(INP$,I,1)) = """ then print "quote"

                        this is the only problem i have run into.

                        ~Matt
                      • William E. Lopez
                        Use the CHR$(34) character to have your code print to the screen. You can also concatenate strings in this manner when sending to the line printer. [code]
                        Message 11 of 27 , Sep 2, 2005
                        • 0 Attachment
                          Use the CHR$(34) character to have your code print to the screen. You can also concatenate strings in this manner when sending to the line printer.

                          [code]
                          PRINT "My name is "+CHR$(34)+"Welopez"+CHR$(34)
                          [/code]


                          [Non-text portions of this message have been removed]
                        • Chergarj@cs.com
                          In a message dated 09/02/2005 6:55:38 PM Pacific Daylight Time, ... Maybe for that, you really do need ascii value. G C [Non-text portions of this
                          Message 12 of 27 , Sep 2, 2005
                          • 0 Attachment
                            In a message dated 09/02/2005 6:55:38 PM Pacific Daylight Time,
                            mge@... writes:
                            > how would i get the program to do this?? it thinks that the " is the
                            > end of the variable.
                            >
                            > if (MID$(INP$,I,1)) = """ then print "quote"
                            >
                            > this is the only problem i have run into.
                            >
                            > ~Matt
                            >
                            Maybe for that, you really do need ascii value.

                            G C


                            [Non-text portions of this message have been removed]
                          • matt
                            Thanks. i fegot about the chr$(#) ~Matt
                            Message 13 of 27 , Sep 2, 2005
                            • 0 Attachment
                              Thanks. i fegot about the chr$(#)

                              ~Matt
                            • ralph_iden_fsc
                              ... the ... In your example above, you have three quote characters in a row. BASIC uses quotes to indicate the beginning and end of a string (i.e. Test ).
                              Message 14 of 27 , Sep 2, 2005
                              • 0 Attachment
                                --- In libertybasic@yahoogroups.com, matt <mge@p...> wrote:
                                > how would i get the program to do this?? it thinks that the " is
                                the
                                > end of the variable.
                                >
                                > if (MID$(INP$,I,1)) = """ then print "quote"
                                >
                                > this is the only problem i have run into.
                                >
                                > ~Matt
                                In your example above, you have three quote characters in a row.
                                BASIC uses quotes to indicate the beginning and end of a string
                                (i.e. "Test"). When the parser tries to analyze your statement, it
                                gets confused. It thinks you specified an empty string (i.e. "")
                                followed by the start of another string.

                                When you need to refer to a quote character within a string, do what
                                William said, use the CHR$ code instead. The CHR$ code for the
                                double quote is 34 so your statement should read...

                                if (MID$(INP$,I,1)) = CHR$(34) then print "quote"

                                Remember that CHR$ and its counterpart, ASC, only process 1 character
                                of the string. This is why you need the FOR NEXT loop to process
                                each character of the string individually.
                              • matt
                                Don t worry, i knew that was what was happening, but i didnt know how to phrase it :( ~Matt
                                Message 15 of 27 , Sep 5, 2005
                                • 0 Attachment
                                  Don't worry, i knew that was what was happening, but i didnt know how to
                                  phrase it :(

                                  ~Matt
                                Your message has been successfully submitted and would be delivered to recipients shortly.