Mumpster
http://mumpster.org/

Help
http://mumpster.org/viewtopic.php?f=13&t=1804
Page 1 of 1

Author:  rustybucket323 [ Wed Mar 23, 2016 10:23 am ]
Post subject:  Help

I'm trying to create two programs and I'm stuck beyond no END.
Problem 1:
I'm having the user read a line about "Peter" but then I want the program to change "Peter" to Paul. This is the code I've written so far.

Code:
XRRPPETERREPLACE
    n str
    f  r !,"Enter a line about Peter: ",str q:str=""  d
    . s str=^XNAME(str)=""
  f  s str=$O(^XNAME(str)) q:str=""   s $E(str,$F(str,"Peter")-  $L("Peter"),$F(str,"Peter")-1)      ="PAUL" w !,str
    q

Any Thoughts would be greatly appreciated.

Problem 2:
Character Counting in a string?
This is something That I just can not figure out.
For example
Code:
CHARCOUNT
 n str
 f  r !,"Enter patient's name: ",str q:str=""  d
 . s ^XPTNAME(str)=""
 w #
 f  s str=$O(^XPTNAME(str)) q:str=""  w !,"A = ",$L(str,"A")
 q



I used $L to hard code each line for each letter or character, but I think that would be labourous. I understand that I will need to use $ASCII and $CHAR. I'm just not sure how to get it accomplished

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/