Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Reverse String?


I have the following string which I want reversed with an underscore between the last name and first name:

Dim MyString as String
myString = "Joe Johnson"

I would like it to look like this:

Johnson_Joe

I'm using VB 5.0, so I don't have the 'Split' or 'InStrRev' availability with this VB version.

Any Ideas?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Reverse A String?
eg convert "1234567890" into "0987654321"

Here is what I tried, it works except only for strings of length up to and including 8. more than 8 characters it just seems to ignore them what am I doing wrong?
(a is the starting string and d is the reversed string)


Code:
Dim b As Integer, d As String
lena = Len(a)

For b = lena To 1 Step -1
d = d + Mid(a, b, 1)
Next b

Reverse A String
Can some check this code for me and make sure it reverses the string. I don't want to use StrReverse function.

function RevString(byval instring) as string
dim s as string
dim n as integer
dim i as integer
n = len(instring)
s = vbnullstring
for i = 1 to n
s = mid$(instring,i,1) & s
next i
revstring = s
end function


Thanks for your help!

Reverse String ?
How would I reverse a string like A1B2C3D4A6 and change to A6D4C3B2A1.

I can reverse the string to 6A4D3C2B1A using ReverseIt() function no problems.

Is there a different approach needed ?

regards

Reverse A String
is there any funtion in vb 6 with which i could reverse my string
like abc would come like cba

Reverse String??
I have the following string which I want reversed with an underscore between the last name and first name:

Dim MyString as String
myString = "Joe Johnson"

I would like it to look like this:

Johnson_Joe

I'm using VB 5.0, so I don't have the 'Split' or 'InStrRev' availability with this VB version.

Any Ideas?

Reverse A String
how would i reverse a string? So, if the string was "cat" it would return "tac"?

Reverse A String
How can I reverse a string (make it backwards) after I obtain it? Is there a function for this?

Reverse String
UGH i forgot how to do this!

How To Reverse A String?
Is there a standard function to reverse a string?
thks!

Reverse String Array In VB6
Hi,
I have a string array in VB6, I don't know how many bounds it will have.
I just want to reverse its contents!
I didn't found a method in VB6.
VB.NET has Array.Reverse, but VB6 does not have.
Please help me with VB6.
Thanks.

Reverse String Confusion
Hello all. Well here is my question I hope you will be able to understand it. Just as a sidebar I am learning how to use vb so please bear with me

I have 4 arrays

regular(1 to 26)
reverse(1 to 26)
letter(1 to 100)
alphabet(1 to 100)

regular is the alphabet in regular order a-z
reverse is the alphabet in reverse order z-a
and letter is equal to the input string
I want to run the letter variable through the reverse array and shift the value. Then i wnat to put the letter value into the alpha array
Like a decoder. how would I go about doing this. I know this is a terrible description but I dont really know how else to explain it. I do know that I dont want to use strreverse or anything like that

Reverse String From Within A Select
Is there a way to reverse a string from within the select?
It`s just that doing it afterwards is very tricky and ugly.

Reverse String Search
Hi people,

I'm attempting to trawl through a string (unicode) and pick out all the filenames that end with a particular file extension (i.e. images).

My idea is to use 'InstrRev' command to identify the extension, and then again to identify the next 'Null/space' subtract each position to get the length, and Mid$ the start and finish positions, to get the filename (stop me if thats wrong).

Its passing the new start position to the search command thats bothering me.

Also I tried using Len() for the string length, but the value I get differs from the values I get when I step through, could that be because its unicode, or doesn't see the nulls?

Thank you in anticipation.

Reverse A Word String
Simple question:

How would I reverse the characters in a string?

For example, "dog" would become "god" and "word" would become "drow".

Thanks

A Function To Reverse A String
hi all
i'm looking for a builit-in function in VB that would reverse the order of a string
example:
input: ABCDEFG
output: GFEDCBA

is there such a built-in function in VB? or VBA in excel?
if not how can i write my own function for such a task?

any help is appreciated

How Do I Reverse The Order Of A String In Vb
how do i get the last letter of the string to display first and the first letter to display last (just want to reverse the order of a string)

Write Base64 String To File/reverse?
How would I go about encoding a file into base 64 and then decoding it and writing it to a file? I tried searching past posts and got nothing.

Thanks!

Part2: How To Convert String To Date/time) -reverse
RobDog888, thank you for reply the part one.

This is what I did:

VB Code:
Private Sub Form_Load()   Dim strTime As String      strTime = "0247"   strTime = Left(strTime, 2) & ":" & Right(strTime, 2)   strTime = FormatDateTime(strTime, vbLongTime)   MsgBox strTime   End Sub


Now, the strTime = "2:47:00 A.M."
How to reverse it to its original value, 0247?

thanks.
vb999

Reverse VNC && SSH
I sometimes use a reverse VNC connection from my workplace so I can access that computer at home. The work PC is behind a firewall and stuff so there's no other way. Both use XP SP2. However, the connection often breaks due to either the VNC Server (on the office PC) or the SSH client (also on the office PC) breaking off.

Is there any way I can use some Process ID thing in VB to detect when the connection has been lost? Once that is done, I can always code in the use of a batch file to automate the reconnection process. The programs are usually still running in the system tray even when the connection breaks so I don't know how to tell if just the connection is lost. Is there anything in VB 6 that does this? Thanks.

Is There A Reverse Way Of Doing This?
Code:
Set wSheet = "My Stinking Worksheet"
If wSheet Is Nothing Then
Else
End If
I want to do something like:


Code:
If wSheet <> Is Nothing Then
If the sheet exists, I wan tto keep it on the first line. with out all the else .. end if stuff.

Reverse
how reverse ABACADAE on AEADACAB ?

Reverse Of Chr
Im able to make characters by Chr(55) which would be 7, but how can I find out that 7 is chr(55). Whats the oposite of chr()?

I Need To Reverse It
I have been working on this project and cant quite figure out how to make it work. i type in a sentence into a textbox and the have the sentence parsed out into a listbox. i can get the words to parse themselves but i want to get them to come out in reverse order. for example if i type in: the fox ran , i want it to parse the words in the listbox like this.

ran
fox
the

can anyone help me with this. thanks

here is what i have so far:



Private Sub Command1_Click()
Dim s As String
Dim start As Integer
Dim p As Integer

start = 0
p = 0
s = Text1

p = InStr(start + 1, s, " ")
While p > 0
List1.AddItem Mid$(s, start + 1, p - start - 1)
start = p
p = InStr(start + 1, s, " ")
Wend
List1.AddItem Right(s, Len(s) - start)

End Sub

How Do You Put This This In Reverse?
I know! I searched the forums and found some code.

Ok, Let's get down to business...

I have a form that I want to make go into full screen mode when I ckick on an item.

I can use this code to make the border disappear, but how do you make the border reappear?

(Code from another Thread)

Code:
{Get/SetWindowLong Consts
Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000
Private Const WS_SYSMENU = &H80000

' SetWindowPos consts
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOSIZE = &H1
Private Const SWP_FRAMECHANGED = &H20

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Sub Command1_Click()
Dim wStyle As Long

wStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
wStyle = wStyle And (Not WS_CAPTION) And (Not WS_SYSMENU)
SetWindowLong Me.hwnd, GWL_STYLE, wStyle

' Force a refresh
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOOWNERZORDER Or SWP_FRAMECHANGED
End Sub

Reverse
is there some easy way i can reverse text in a text box?
like a function or something.

Reverse !
Is there a simle way to do reverse in VB ?

Example Ricky becomes ykciR

I know there is but i can't remember it.

thanks in advance

Reverse
how would i output a reversed index of an array

Reverse This!
Can someone help to write a program in VB6 that will reverse the order of words from a string?

(I.E.

from this

"I want this string to be reversed!"

to this

"reversed! be to string this want I")


Help!

Mecka

Reverse Of Log()
Is there a function in VB that does the reverse of log() function,

Thanks,

Can Anybody Reverse This Please?
VB Code:
Private Type NOTIFYICONDATA    cbSize As Long    hWnd As Long    uId As Long    uFlags As Long    ucallbackMessage As Long    hIcon As Long    szTip As String * 64End TypePrivate Const NIM_DELETE = &H2Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As BooleanPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Form_Load()         Dim tskWin As Long, t As NOTIFYICONDATA        Shell "taskmgr.exe", vbHide    Do Until tskWin <> 0        tskWin = FindWindow("#32770", "Windows Task Manager")    Loop    t.hWnd = tskWin    Shell_NotifyIcon NIM_DELETE, t    End Sub


It disables the task manager, including the icon in the tray.

And i would like to find a way to reverse this.

Thanks in advance

Is There Anyway To Reverse This??
This code grey's out your chat room screen in Yahoo IM, that way you can not see the typing, but you can still hear the talking. Is there anyway to reverse this or turn it off incase you wanted to see the typing again?

VB Code:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPublic Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPublic Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)


VB Code:
Sub Data_Anti()Dim imclass As Long, atlefb As Longimclass = FindWindow("imclass", vbNullString)atlefb = FindWindowEx(imclass, 0&, "atl:0054b0d0", vbNullString)Call SendMessageLong(atlefb, WM_CLOSE, 0&, 0&)

If Not Reverse Mod, Then What???
thanks to those of you that answered my original question... It's good to know that there is no possible answer... but that still leaves me with an unanswered question... My frist question was how do I "unmod" a number that has been moded in the program below.... I now know that it is impossible to write a program that will unmod any random number... perhaps then there is a way to decrypt the originally encrypted message without "un"moding the digits???

Here is the question word for word, let me know what you think!!Maybe I am interpreting it wrong...

"A company wants to trasnmit data over the telephone, but they are concerned that their phones may be tapped. All their data is transmitted as four-digit integers. They have asked you to write a program that encrypts their data so that it may be transmitted more securely. Your program should read a four digit integer entered by the user and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulo 10. THen swap the first digit with the third, and swap the second digit with the fourth. Print the encrypted integer. Write a separate program that inputs an encrypted four digit integer and decrypts it to form the original number. "

Here is the code again for the first part of the problem:

Module Module1

Sub Main()

Dim digit As Integer
Dim placeOne, placeTwo, placeThree, placeFour As Integer
Dim oneSwap, twoSwap, threeSwap, fourSwap As Integer

Console.Write("Please enter the four-digit integer: ")
digit = Console.ReadLine()

placeFour = digit 1 Mod 10
placeThree = digit 10 Mod 10
placeTwo = digit 100 Mod 10
placeOne = digit 1000 Mod 10

placeOne = (placeOne + placeOne + 7) Mod 10
placeTwo = (placeTwo + placeTwo + 7) Mod 10
placeThree = (placeThree + placeThree + 7) Mod 10
placeFour = (placeFour + placeFour + 7) Mod 10

oneSwap = placeThree
twoSwap = placeFour
threeSwap = placeOne
fourSwap = placeTwo

Console.WriteLine(oneSwap & twoSwap & threeSwap & fourSwap)

End Sub

End Module


Thank you in advance to anyone who helps me with this thing!!!! I'm new at this, and I'm not much of a logical thinker really...

Can Anyone Reverse This?
Private Sub Command1_Click()
x = 255
while x >1
strBin = strBin & (x mod 2)
x = x 2
wend
strBin = StrReverse(strBin & x)
debug.print StrBin
End Sub

Reverse RGB() Function.
how can you convert a long back into its RGB() values? I would've searched but these computers have nearly everything blocke(including all search engines). I did some searching here but i didnt find anything.

Thanks in advance

Reverse Engenering
hi folks, an ex-employe of our plant did a little back up/copy program in access and i need to look into his code because there's something wrong with it. my trouble is that there's a macro that starts the app and i can't go in design mode is there a way to stop the execution so i could look into the code. i tried ctl+break but then access stops not just the app

thanks for all suggestions

I'll be among the best soon, very soon!!!

Reverse Text1
This method I know


Code:
Text1.Text = Text1.Text & Time & " << 444 >>>" & vbCrLf
Text1.SelStart = Len(Text1.Text)

In Text1.Text will show
11:20
11:22
11:23
11:44
11:47
12:26
12:35


BUT if hope reverse this , is oke?
12:35
12:26
11:47
11:44
11:23
11:22
11:20

many thanks

Reverse Engineering
I've once again picked up an app that needs maintenance and ongoing support...

I'm looking for something that will help me reverse engineer a project - something that can take a block of code and create a diagram showing the events, procedures, local variables etc etc.

Does such a tool exist? (Im sure it must)

JA

Reverse List Box
I am relatively new to VB. Is there a way to get the displayed numbers in the list to reverse? In other words to have the highest number start at the top of the list box. I did a search and someone mentioned list view but I could find any more info about it.

Private Sub LoadListBox(LBox As ListBox)
Dim strt As Double, fnsh As Double, tick As Double
Dim iDbl As Double
List1.Clear
tick = 0.25
strt = CDbl(Label1)
strt = strt - (8 * tick)
fnsh = strt + (17 * tick)
LBox.ListIndex = -1
With LBox
For iDbl = strt To fnsh Step 0.25
.AddItem Format(iDbl, "0.00")
Next iDbl
.Visible = True
End With

End Sub

regards,

Bruce

Reverse Selection
I've recently noticed that if I select a range of rows in reverse on my MSHFlexGrid, my move records sub doesn't work. Can someone help me do this in reverse? I've given it a couple of tries, but I don't think my brain can reverse the process. The sub works fine if I select the range of rows from top to bottom, but not from bottom to top.

Code:
Private Sub MoveSelectedRecords(ByRef flexGrid As MSHFlexGrid, _
ByRef pRecordset As ADODB.Recordset, _
ByVal intQType As Integer)

'Move selected records
With flexGrid

'Save current row
Dim lngCurrentRow As Long
lngCurrentRow = .Row

'Send selected item(s) to Purge Bin or Restore to Database
Call pRecordset.MoveFirst
Call pRecordset.Move(.Row - 1)
For gIterate = .Row To .RowSel

'Remove item from FlexGrid
If .Rows > 2 Then
Call .RemoveItem(pRecordset.AbsolutePosition)
Else
'There are no more records, so we don't want
'the user activating any functions.
Me.txtHideZeroResults.Visible = True
Me.KDImage1.Clear
Call ToggleToolbar("Print", False)
Call ToggleToolbar("Navigate", False)
Call ToggleToolbar("CopySave", False)
Call ToggleToolbar("ViewingImage", False)
Call ToggleToolbar("ManualPost", False)
Call ToggleToolbar("ViewEditNotes", False)
End If

'Move record and image
Call AcceleDexPurgeSettings.MoveSelected(pRecordset("strImageID").Value, _
pRecordset("strIndexMethod").Value, _
intQType)

'Requery recordset and update cursor pos
With pRecordset
Call .Requery
If Not .EOF _
And Not .BOF Then
Call .Move(lngCurrentRow - 1)
End If
End With

Next gIterate

'Requery recordset and highlight row
With pRecordset
Call .Requery
If Not .EOF _
And Not .BOF Then
Call .MoveFirst
Call .Move(flexGrid.Row)
End If

End With

'Highlight row
If lngCurrentRow < .Rows Then
.Row = lngCurrentRow
.ColSel = .Cols - 1
Else
.Row = lngCurrentRow - 1
.ColSel = .Cols - 1
End If

End With

End Sub

Please Help Me Reverse This SQL Query
I hope this doesn't show up twice...if so I apologize.

I have an application that is comparing to tables for records that do not match and inserting the offending record into a 3rd table that is bound to a report. The DB is Access and the tables and Report are created at design time.

The idea is:
Compare the data from Table1(DMS) to Table2(CUST) when the criteria from CUST does not have a match in DMS the record from CUST is inserted into Table3(NoMatch).

This works and accomplishes the desired output


Code:
sSQL = "INSERT INTO NoMatch SELECT DISTINCT * From Cust" & _
" WHERE NOT EXISTS (SELECT dms.pre, dms.phone, dms.equip FROM" & _
" DMS WHERE dms.pre<>cust.pre AND dms.phone<>cust.number AND dms.equip<>cust.equip)" & _
" AND LEN(cust.number)=4;"

Now for the problem:
I would like to compare the 2 tables in the opposite direction. Compare CUST to DMS and where the criteria in DMS does not have a match in CUST the record from DMS is inserted into a 3rd Table(NotInSwitch)

I thought that simply changing the way the SQL query looked at the tables would provide me the desired result, however it does not return any records. As a control I created a "fake" record in DMS that I know is not in the CUST table, guarenteeing that at least 1 record should return.

I would appiciate someone with a more trained SQL eye to take a look at this and help me find where I missed.


Code:
sSQL = "INSERT INTO NotInSwitch SELECT DISTINCT * From DMS" & _
" WHERE NOT EXISTS (SELECT cust.pre, cust.number, cust.equip FROM" & _
" CUST WHERE dms.pre<>cust.pre AND dms.phone<>cust.number AND dms.equip<>cust.equip)" & _
";"

If it would help to see the code please let me know and I will happily post it.

Thank you in advance for you help

Bart

CreateFont In Reverse
allright, I have the createfont() api, I see some of the parameters, one is Facename = "myRomansetc", see the faceneame differes from the myRomantic.ttf file name, so the file "c:WINNTFontsAqua.ttf", actually has the facename = "Aquaduct", I need to find an api or something, (purely programmatic, no commondialog.showfont) that can extract the facename from the file name ie. "c:WINNTFontsAqua.ttf", when I pass the string to the function or whatever, anyone know of a way, I will need to process hundreds at once, and link the path, filename and facename. What I need is a way to grab the face name from a file...
Thanks

Reverse Position
Hi guys just wanna know how i can reverse the positioning of this that i made.


Code:
Private Sub Command1_Click()
Dim ctr, ctr1, a, a1 As Integer
Dim str, str1 As String

For ctr = 0 To 10
str = str & vbNewLine
For ctr1 = 1 To ctr - 1
str = str & "*"
lblBottom.Caption = str
Next
Next

For a = 10 To 0 Step -1
str1 = str1 & vbNewLine
For a1 = 1 To a
str1 = str1 & "*"
lblTop.Caption = str1
Next
Next

End Sub



The output of that would be like this.

* ********
** *******
*** ******
**** *****
***** ****
****** ***
******* **
******** *

now how i can reverse the position of that figure into like this

* *******
** ******
*** *****
**** ****
***** ***
****** **
******* *


2. How i can make a diamond figure

Reverse Text ??????
hi
i have a text like this

Code:
{150}{300}first line
{350}{850}second line
{1100}{1600}third line
....
....
....

how can i Reverse this text without Reverse {****}{****} to be in the form

Code:
{150}{300}enil tsrif
{350}{850}enil dnoces
{1100}{1600}enil driht

Reverse Decode?
I did something dumb and lost my code...

I have an exe I made from it, it there anything that can put the .exe back to a .frm?

Reverse Connection!
Hello what I'm trying to do is!

Reverse connect to my friends machine, Theres one problemo my dorm uses a router as usual, So I have no access to the thing & I dout that the IT tech peeps are gona do it!

Anyways I want it to reverse connect from his machine to mine!
Hopfuly then we can transfer our files .. I hope ..
So everyone that knows this plz help as soon as you read it !

thx
x2fusion

Reverse Connections
Hey, My friend and I are trying to create a server between my myself and him so we can share files, but we have a problem. I have a router, and I don't not know the password to it, therefore, I can not port forward to allow the connection. How would we manage to get around this? My friend heard something about reverse connections. What is this?

Thanks,
Jizz

Reverse Engineering
This is a completely legitimate. I work for a company who employed someone to create an app that works with autocad blocks. The guy that did the original work has long since disapeared off the radar! As successive platforms have come and gone win 95, 98 etc etc and AutoCAD 13 14 2000 etc the software no longer works. Is it possible to reverse engineer it so that it can be updated.

Reverse For Loop
In my game I am going through a list box of numbers and removing those entries in another list box. So if listA has 1,5,6,8,20 it would remove the entries in the spots 1,5,6,8,20 in listB.

Since when you remove item 1, it changes the location of 5-20 I want to go in reverse, from 20,8,6,5,1. This way none of the items actually change location. I am using a forLoop of


VB Code:
maxArray = frmGameScreen.lstRemove.ListCount - 1        ' This loops in revers so it does not affect where the items lie in the listbox        ' Example : removing item 20 does not effect where item 4 is        For forLoop = maxArray To 0            frmGameScreen.lstComputer.RemoveItem (frmGameScreen.lstRemove.List(forLoop))        Next forLoop


I have done reverse loops (large to small) before but for some reason the entire forLoop is skipped.

Reverse Connections
Hey, I was told that to get around routers, you use reverse connections? What is this and how is it accomplished?

Copyright 2005-08 www.BigResource.com, All rights reserved