[Show all top banners]

darkside
Replies to this thread:

More by darkside
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 vb 6 help!!!
[VIEWED 2903 TIMES]
SAVE! for ease of future access.
Posted on 07-18-07 8:34 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Can you guys plz help me on this....
i need to convert any text and number of textbox1 in reverse in textbox2
but my problem is i need to convert numeric in english word.
for example:
user input textbox1 = abc123
output on textbox2 should be threetwoonecba
any help will be appriciated!!!

thank you in advance
 
Posted on 07-19-07 8:16 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Here how U can do it.
Create a table where you will store world for the numbers (0 to 9).
Then use the reverse function. When ever you hit the number go to the table and convert it.

It will work for sure.

GOOD luck
 
Posted on 07-19-07 10:14 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

first of all put the letter in for loop, something like

for i = len(InPut) to 1 step -1
then use RIGHT function to extract the last letter
use if statement, if letter = 1 then "One" -- I think u can use REPLACE function as well
concatenate and accumulate it in a output variable
next i

I don't really know VB that well, but giving you a logic. THere could be tons of other logic to accomplish this.

Goodluck
 
Posted on 07-19-07 12:17 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

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'


--********
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
मन भित्र को पत्रै पत्र!
TPS Work Permit/How long your took?
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
Travelling to Nepal - TPS AP- PASSPORT
Morning dharahara
Another Song Playing In My Mind
Does the 180 day auto extension apply for TPS?
1974 AD Pinjadako Suga Remixed
Susta Susta Degree Maile REMIXED version
Elderly parents travelling to US (any suggestions besides Special Assistance)?
कल्लाई मुर्ख भन्या ?
ढ्याउ गर्दा दसैँको खसी गनाउच
जाडो, बा र म……
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters