[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 3533 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 365 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Toilet paper or water?
TPS EAD auto extended to June 2025 or just TPS?
Biden out, Trump next president, so what’s gonna happen to TPS, termination?
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
मन भित्र को पत्रै पत्र!
Will MAGA really start shooting people?
Democrats are so sure Trump will win
I hope all the fake Nepali refugee get deported
From Trump “I will revoke TPS, and deport them back to their country.”
Tourist Visa - Seeking Suggestions and Guidance
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
Top 10 Anti-vaxxers Who Got Owned by COVID
Nas and The Bokas: Coming to a Night Club near you
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