home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMIGA PD 1
/
AMIGA-PD-1.iso
/
Programme_zum_Heft
/
Programmieren
/
Kurztests
/
ACE
/
include
/
strings.h
< prev
next >
Wrap
Text File
|
1994-10-23
|
3KB
|
91 lines
From XRACTON@FULLERTON.EDU Thu Jun 24 00:39:17 1993
Return-Path: <XRACTON@FULLERTON.EDU>
Received: from csu.Fullerton.EDU by leven.appcomp.utas.edu.au (4.1/SMI-4.1)
id AB05310; Thu, 24 Jun 93 00:39:07 EST
Received: from FULLERTON.EDU by FULLERTON.EDU (PMDF #2446 ) id
<01GZPKE341KY002QFT@FULLERTON.EDU>; Wed, 23 Jun 1993 07:36:41 PST
Date: 23 Jun 1993 07:36:41 -0800 (PST)
From: ROLAND ACTON <XRACTON@FULLERTON.EDU>
Subject: strings.h
To: dbenn@leven.appcomp.utas.edu.au
Message-Id: <01GZPKE341L0002QFT@FULLERTON.EDU>
X-Vms-To: IN%"dbenn@leven.appcomp.utas.edu.au"
Mime-Version: 1.0
Content-Transfer-Encoding: 7BIT
Status: OR
Rem *** LCASE$ (function)
Rem ***
Rem *** FUNCTION:
Rem *** Simulates the LCASE$ function hard-wired into some other
Rem *** BASICs. Takes a string as input, and returns that string
Rem *** with all uppercase letters converted to lowercase.
Rem ***
Rem *** REVISION HISTORY:
Rem *** Version 1.0: Roland Acton (xracton@ccvax.fullerton.edu)
Rem ***
Rem *** BUGS:
Rem *** Can only handle strings up to MAXSTRINGLEN.
SUB LCASE$(A$)
Longint STEPPER
String B$
B$=A$
STEPPER=@B$
Rem *** Not perfectly portable, but everybody uses ASCII these days,
Rem *** right?
Repeat
If Peek(STEPPER)>=65 And Peek(STEPPER)<=90 Then
Poke STEPPER,Peek(STEPPER)+32
End If
++STEPPER
Until Peek(STEPPER)=0
LCASE$=B$
END SUB
Rem *** MIDCOM$ (function)
Rem ***
Rem *** FUNCTION:
Rem *** Simulates the MID$ command. A$, starting at position B%, has
Rem *** its contents replaced by C$. This is done until either D%
Rem *** characters have been replaced, or the end of either A$ or C$
Rem *** has been reached. This is consistent with the way it is
Rem *** implemented in AmigaBASIC (though AmigaBASIC uses a
Rem *** different syntax). The contents of A$ are then returned to
Rem *** the calling program.
Rem *** For example, if NAME$ contains the string "Goodbye",
Rem ***
Rem *** NAGISA$=MIDCOM$(NAME$,2,"Iczer",1)
Rem ***
Rem *** will make NAGISA$ contain the string "GIodbye". NAME$ will
Rem *** be unaffected. Thus, if you actually wanted to alter NAME$
Rem *** (as the "real" MID$ command would do) you would have to use
Rem ***
Rem *** NAME$=MIDCOM$(NAME$,2,"Iczer",1)
Rem ***
Rem *** Note that since ACE does not allow function overloading, all
Rem *** four parameters are required. Pass D% a very high number if
Rem *** you want it ignored.
Rem ***
Rem *** REVISION HISTORY:
Rem *** Version 1.0: Roland Acton (xracton@ccvax.fullerton.edu)
Rem ***
Rem *** BUGS:
Rem *** None known.
SUB MIDCOM$(A$,B%,C$,D%)
Longint STEPA, STEPC
STEPA=@A$+B%-1
STEPC=@C$
While Peek(STEPA)<>0 And Peek(STEPC)<>0 And D%>0
Poke STEPA,Peek(STEPC)
++STEPA
++STEPC
--D%
Wend
MIDCOM$=A$
END SUB