User Tools

Site Tools


python_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
python_examples [2018/01/05 15:52] g00r00python_examples [2018/01/05 15:56] g00r00
Line 4: Line 4:
  
   * [[python_examples#Simple Message Reader|Simple Message Reader]]   * [[python_examples#Simple Message Reader|Simple Message Reader]]
 +  * [[python_examples#MCI Helper Functions|MCI Helper Functions]]
  
 ----- -----
Line 123: Line 124:
  
 writeln("|CR|12Program complete: Press a key|PN"); writeln("|CR|12Program complete: Press a key|PN");
 +
 +</file>
 +
 +-----
 +===== MCI Helper Functions =====
 +
 +<file python mcihelp.mpy>
 +
 +import mystic_bbs as bbs;
 +
 +def stripmci (str):
 + pos = str.find("|")
 +
 + while pos != -1:
 + str = str[:pos] + str[pos+3:]
 + pos = str.find("|")
 +
 + return str
 +
 +def mcilen (str):
 +
 + return len(stripmci(str))
 +
 +
 +text = "|12This is a |14test";
 +
 +bbs.rwriteln(stripmci(text));
 +bbs.rwriteln(str(mcilen(text)))
 +
 +bbs.writeln("|PA")
  
 </file> </file>
python_examples.txt · Last modified: 2019/03/09 21:40 by g00r00

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki