$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB12" '/*-----------------------------------------------------------------*/ '/* TRANSLATE$(BYVAL S$, BYVAL O$, BYVAL I$) '/*-----------------------------------------------------------------*/ FUNCTION TRANSLATE(BYVAL S$, BYVAL O$, BYVAL I$, BYVAL PAD AS STRING) PUBLIC AS STRING LO = LEN(O$) IF O$ = " " AND I$ = " " THEN S$ = UCASE$(S$) ELSE SL = LEN(S$) FOR CNT = 1 TO SL T$ = MID$(S$,CNT,1) :'Get Source String Character S = INSTR(1,I$,T$) :'Character matches Input string table? IF S <= LO AND S > 0 THEN MID$(S$,CNT,1) = MID$(O$,S,1) :'Replace it IF S > LO AND S > 0 THEN MID$(S$,CNT,1) = PAD:'Replace it NEXT CNT END IF FUNCTION = S$ END FUNCTION '/*-----------------------------------------------------------------*/