It is currently Mon Nov 20, 2017 9:13 pm


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Help
PostPosted: Wed Mar 23, 2016 10:23 am 

Joined: Wed Mar 23, 2016 9:48 am
Posts: 1
Real Name: Ricardo Johnson
Began Programming in MUMPS: 02 Mar 2016
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


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net