faqts : Computers : Programming : Languages : Tse : Recursion

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 14 people (79%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

TSE: Programming: Recursion: String: Reverse: How to write recursive string reverse function in TSE?

Jan 1st, 2005 08:14
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 01 January 2005 - 05:29 pm --------------------

TSE: Programming: Recursion: String: Reverse: How to write recursive 
string reverse function in TSE?

---

Steps: Overview:

 1. -Create the following program

--- cut here: begin --------------------------------------------------

 STRING PROC FNStringGetCharacterReverseSubS( STRING s, STRING 
reverseS )
  IF s == "" RETURN( reverseS ) ENDIF
  RETURN( FNStringGetCharacterReverseSubS( s[2:Length(s)], s[1] + 
reverseS ) )
 END

 STRING PROC FNStringGetCharacterReverseS( STRING s )
  RETURN( FNStringGetCharacterReverseSubS( s, "" ) )
 END

 PROC Main()
  Message( FNStringGetCharacterReverseS( "hello" ) ) // this will 
print 'olleh'
 END

 <F12> Main()

--- cut here: end ----------------------------------------------------

 2. -Save this macro

 3. -Compile this macro

 4. -Run this macro

 5. -That will show on the statusbar below left

      olleh

---
---

Internet: see also:

---

TSE: Programming: Recursion: Link: Overview: Can you give me an 
overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/33130/fid/1738

----------------------------------------------------------------------