ramma
asked on
reversing numbers
hi experts..
i have this a number that consists of unknown no of digits(1 or 12 ... or 12345).
i need firstly to reverse this number for example if the number is 12345 it should be converted to 54321.
also i have to put a dot between every digit so it should be 5.4.3.3.1.
Any idea?
i have this a number that consists of unknown no of digits(1 or 12 ... or 12345).
i need firstly to reverse this number for example if the number is 12345 it should be converted to 54321.
also i have to put a dot between every digit so it should be 5.4.3.3.1.
Any idea?
ASKER
Tim am sorry but how can replace . with space?
instead 5.4.3.2.1 it should be 5 4 3 2 1 ?
instead 5.4.3.2.1 it should be 5 4 3 2 1 ?
TimCottee,
> mynewstring = mynewstring & substring(mystring,intpos, 1) & " "
Tim
> mynewstring = mynewstring & substring(mystring,intpos,
Tim
College assigment ?
I remember one of the questions in my college was
How many direct connections does it take to connect n computers together? Suppose you have a computer in each of the 50 states in the United States; how many direct connections would you need?
I remember one of the questions in my college was
How many direct connections does it take to connect n computers together? Suppose you have a computer in each of the 50 states in the United States; how many direct connections would you need?
ASKER
Dear Tim .. I got this error in this line :
-------------------------- ---------- ---------- ---------- ---------- ---------- -
mynewstring = mynewstring & substring(mystring,intpos, 1) & " "
-------------------------- ---------- ---------- ---------- ---------- ---------- -
This is the error message :
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'substring'
/people/REVERSE.asp, line 15
Any Idea??
--------------------------
mynewstring = mynewstring & substring(mystring,intpos,
--------------------------
This is the error message :
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'substring'
/people/REVERSE.asp, line 15
Any Idea??
ummmm doesnt StrReverse do this?
dim mystring,newstring
mystring="12345"
mystring = StrReverse(mystring)
for i = 1 to Len(mystring)
newstring = newstring & mid(mystring,i,1) & " "
next
dim mystring,newstring
mystring="12345"
mystring = StrReverse(mystring)
for i = 1 to Len(mystring)
newstring = newstring & mid(mystring,i,1) & " "
next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The question was duplicated here:
https://www.experts-exchange.com/questions/22054581/reversing-numbers-in-a-field.html
https://www.experts-exchange.com/questions/22054581/reversing-numbers-in-a-field.html
ASKER
No it was not duplicated .. i just wanted to do it in SQL or Stored Procedure as i mentiioned there.
Dim mystring
Dim mynewstring
mystring="12345"
Dim intpos
for intpos = len(mystring) to 1 step -1
mynewstring = mynewstring & substring(mystring,intpos,
next
response.write mynewstring
This should show how you can achieve this.
Tim Cottee