| Blockland Forums > Modification Help |
| Client_Punctuation Help |
| << < (5/6) > >> |
| Treynolds416:
--- Quote from: Kalphiter on May 20, 2012, 10:26:37 PM --- --- End quote --- Yea, but I was talking about adam's and his only checks don't and can't |
| adam savage:
--- Quote from: adam savage on May 20, 2012, 09:27:52 PM --- --- Code: ---package Punctuation { function NMH_Type::send(%this) { %txt = %this.GetValue(); %txt = StrReplace(%txt,"cant","can't"); %txt = StrReplace(%txt,"dont","don't"); //GIVEPERIOD DOES NOT WORK YET //%txt = GivePeriod(%txt); %this.SetValue(%txt); } }; ActivatePackage(Punctuation); function addMissingEndPunctuation(%flag) { %endingPunct = ".?!:;"; %questionWords = " who what where when why how "; %len = strLen(%flag); if(%len > 1) { %lastChar = getSubStr(%flag,%len-1,1); if(strPos(%endingPunct,%lastChar) < 0) { %firstWord = firstWord(%flag); if(striPos(%questionWords," " @ %firstWord @ " ") >= 0) { %flag = %flag @ "?"; } else { %flag = %flag @ "."; } } } return %flag; } --- End code --- Untested. But pretty sure it will work. --- End quote --- Found an error, but fixed |
| Greek2me:
--- Quote from: adam savage on May 21, 2012, 08:02:53 AM --- --- Code: ---//GIVEPERIOD DOES NOT WORK YET --- End code --- --- End quote --- Use the function that I posted above instead of your givePeriod function. |
| adam savage:
--- Code: ---package Punctuation { function NMH_Type::send(%this) { %txt = %this.GetValue(); %txt = StrReplace(%txt,"cant","can't"); %txt = StrReplace(%txt,"dont","don't"); %txt = addMissingEndPunctuation(%txt); %this.SetValue(%txt); } }; ActivatePackage(Punctuation); function addMissingEndPunctuation(%flag) { %endingPunct = ".?!:;" %questionWords = " who what where when why how "; %len = strLen(%flag) if(%len > 1) { %lastChar = getSubStr(%flag,%len-1,1); if(strPos(%endingPunct,%lastChar) < 0) { %firstWord = firstWord(%flag); if(striPos(%questionWords," " @ %firstWord @ " ") >= 0) { %flag = %flag @ "?"; } else { %flag = %flag @ "."; } } } return %flag; } --- End code --- All set up and ready to go! |
| jes00:
--- Quote from: adam savage on May 22, 2012, 04:00:32 PM --- --- Code: ---package Punctuation { function NMH_Type::send(%this) { %txt = %this.GetValue(); %txt = StrReplace(%txt,"cant","can't"); %txt = StrReplace(%txt,"dont","don't"); %txt = addMissingEndPunctuation(%txt); %this.SetValue(%txt); } }; ActivatePackage(Punctuation); function addMissingEndPunctuation(%flag) { %endingPunct = ".?!:;" %questionWords = " who what where when why how "; %len = strLen(%flag) if(%len > 1) { %lastChar = getSubStr(%flag,%len-1,1); if(strPos(%endingPunct,%lastChar) < 0) { %firstWord = firstWord(%flag); if(striPos(%questionWords," " @ %firstWord @ " ") >= 0) { %flag = %flag @ "?"; } else { %flag = %flag @ "."; } } } return %flag; } --- End code --- All set up and ready to go! --- End quote --- Lol you took Greek2Me's function and didn't even fix his syntax errors. |
| Navigation |
| Message Index |
| Next page |
| Previous page |