|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
String Reversal using a loop
Could I please get an example of how to reverse a string such as abcde using a loop?
Thanks |
|
#2
|
|||
|
|||
|
public string Reverse_String(string strToReverse)
{ string strToReturn=""; for (int i=strToReverse.Length; i>=0; i--) { strToReturn += strToReverse[i]; } return strToReturn; } EDIT: just realized you probably wanted VB Function Reverse_String(strToReverse as String) as String dim strToReturn as string = "" dim i as integer; For i=strToReverse.Length To i=0 Step -1 strToReturn = strToReturn & strToReverse(i) Next i End Function Last edited by crazytrain81 : April 14th, 2003 at 11:46 AM. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > String Reversal using a loop |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|