HERE IS how I did with sql procedure.
I guess the logic is the same for VB as well. CHECK IT OUT.
--********
-- table to hold number and word for 0-9
Create table dbo.bsNtoT
(Num int,
Word varchar(20)
)
--insert script for lookup table
insert into dbo.bsNtoT values (0,'zero')
insert into dbo.bsNtoT values (1,'one')
insert into dbo.bsNtoT values (2,'two')
insert into dbo.bsNtoT values (3,'three')
insert into dbo.bsNtoT values (4,'four')
insert into dbo.bsNtoT values (5,'five')
insert into dbo.bsNtoT values (6,'six')
insert into dbo.bsNtoT values (7,'seven')
insert into dbo.bsNtoT values (8,'eight')
insert into dbo.bsNtoT values (9,'nine')
--Create procedure do the job
ALTER procedure bsReverse
(
@input varchar(20)
)
as
begin
Declare @i int, @Count int, @iLen int
Declare @NewText varchar(10), @Text varchar(10), @FinalText varchar(100), @check char(1)
set @i=1
SET @FinalText=''
SELECT @Count=len(@input)
SELECT @iLen=@Count
WHILE @i<=@Count
begin
SELECT @NewText=substring(@input,@iLen,1)
SELECT @check= isnumeric(@NewText)
if @check='1'
SELECT @NewText=Word FROM dbo.bsNtoT WHERE Num=@NewText
SELECT @FinalText=@FinalText+@NewText
SET @i=@i+1
SET @iLen=@iLen-1
end
SELECT @FinalText
end
--try running it
exec bsReverse 'ab45c'
--********