message$="I made mistake. I really did !!" PRINT "This is the sentence that has a mistake" PRINT message$ PRINT "1234567^" PRINT "So to make it simple (preserve the first 7 letters and add my letter or word at location 8" message$=FN_addinstr(message$,8,"a") PRINT PRINT "The correction :" PRINT PRINT message$ PRINT "*************************************************************" PRINT "The incomplete word is AT" message$="AT" message$=FN_addinstr(message$,1,"C") PRINT "I added a C to location 1 and it becomes....."; message$ PRINT "So to make it simple (preserve 0 letters and put C at the beginning of the string)" END REM Remember: when using this function, the left of your first letter in your string is 0... REM so if your word was AT --- adding C to make it CAT ould need a plot location of 0 DEF FN_addinstr(stringtomodify$,locationtoadd%,whatstring$) LOCAL lengthofstring%,rightlength%,leftword$,rightword$,finalword$ lengthofstring%=LEN(stringtomodify$) rightlength%=lengthofstring%-locationtoadd% leftword$=LEFT$(stringtomodify$,locationtoadd%-1) rightword$=RIGHT$(stringtomodify$,rightlength%+1) finalword$=leftword$+whatstring$+rightword$ =finalword$
message$="DOHG" PRINT "This is the sentence that has a mistake" PRINT PRINT message$ message$=FN_eatinstr(message$,3) PRINT PRINT "The correction :" PRINT PRINT message$ END REM Remember: when using this function, the first letter in your string is 1... REM so if your word was DOHG, to change it to DOG you would set location to 3 DEF FN_eatinstr(stringtomodify$,locationtoeat%) LOCAL lengthofstring%,rightlength%,leftword$,rightword$,finalword$ lengthofstring%=LEN(stringtomodify$) rightlength%=lengthofstring%-locationtoeat% leftword$=LEFT$(stringtomodify$,locationtoeat%-1) rightword$=RIGHT$(stringtomodify$,rightlength%) finalword$=leftword$+rightword$ =finalword$