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




Looping Through Letters In A String (changed)


sorry if this is a n00b question, but how do select a single, predifined (say by the index of a loop) letter in a string?

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Text To Be Changed To Capital Letters While Entering Data In A Textbox ...
Hi,

How to change the text in a textbox to Capital letters while entering data (at the same time, not at lostfocus)?

Margaret

Looping Letters
How would I loop A to Z (A,B,C,etc.)?

Txt File String (CHANGED)
ok have a txt file with loads of 1,2,3 bit decimal codes, eg 27 64 27 116 1 27 54, i need to convert this with known Epson Codes for example

Printer Operation:
Decimal ASCII Description
7 BEL Beeper
17 DC1 Select printer
19 DC3 Deselect printer
27 25 48 ESC EM 0 Turn cut sheet feeder control off
27 25 52 ESC EM 4 Turn cut sheet feeder control on
27 56 ESC 8 Disable paper out sensor
27 57 ESC 9 Enable paper out sensor
27 60 ESC < Select unidirectional mode for one line
27 64 ESC @ Initialize printer
27 85 48 ESC U 0 Cancel unidirectional mode
27 85 49 ESC U 1 Select unidirectional mode
27 115 48 ESC s 0 Turn half speed mode off
27 115 49 ESC s 1 Turn half speed mode on

whats the best way to store all these codes, as there is loads more and whats the best way to convert from the decimal to charater

i can open the txt file and open a new one and copy into, just really need 2nd opition how to store the epson codes and how to search to find each one

cheers for any help

ADO Connection String Changed At Run Time
I am changing my connection string to a value that I stored in my Registry (Thanks Paul!). I changed this when my first form loads....I tested displaying the connection string in a text box, and yes it is changing...but, the info is still the same than the last connection string... My question is when I change my connection string at run time, do I need to "re" something on the Ado?

Find (changed) String In Text
Hello,
Need some help here.

I have text file which size changes evry 2 min, and in that text file are some
settings for program. I need to extract them, but dont know how since
string changes constantly.
Only 1 thing can make help here and that is, string are always in this
format 0200:004000:1234567890:00:AFB5C4783ADF44AA:126A3F55F56A1122!
When software again change string it look like this :
0200:004000:1234567890:00:22113A3C4A55E123:22FAFF34E2AAF155
Also text size changes sometime from 2-10 kb.
Maybe someone can give some advice here, since I dont know how to find
vbcode or solution.

Example:
0200:004000:1234567890:00:AFB5C4783ADF44AA:126A3F55F56A1122
0200:004000:1234567890:00:22113A3C4A55E123:22FAFF34E2AAF155

B.R
VB Client / Server

String Contains Only Letters
i'd like to validate a string to make sure it only contains letters(A-Z, a-z)...any ideas on how to do this?...thanx in advance

Letters In String
how do you find out how many letters are in a string

string name is uname

String Over 255 Letters
Hi all,
It seems that if I put more than 255 letters into a string, the letter from 255 will not be stored. Can anyone tell me what type can I use?

For example:
Dim abc as string

abc = "...."
^
more than 255 words

Thanks all!!!

Split String To Letters
i have a string which i need to split so that each letter has its own place in an array

this is the code i have but the string is not being split into the array.


Code:
Dim characters() As String
Dim word As String

Word = "hello"

characters = Split(Word,"")

Place Only A Few Letters Of A String
Hello,

I have a the following problem:
I have a string with value "072151" now I only want to put the first 4 digits into a label, how can I do this?

Thanx in advance.

Removing Letters From A String
I need to make a program that removes all the vowels found at the end of a string.

For example:
my name, Charlie

I need it to look like charl.

How would I make it search for vowels only at the end of the word like that?

Counting Letters In A String
I'm trying to figure out how to count how many times a letter appears in a string, ive been trying various things with no luck. I know its going to turn out to be something simple that I'm just forgetting to do, but any help would be appreciated.

Checking String Has Letters Only
Just tried to make sure that a text box contains only numbers by using an if statement with..

if txtpass.text <= 0 or >= 9999 then
exit sub
else
call functionRun
end if

but when letters are entered it gives an error, any idea how i can get around that? thanks

Remove/Add Letters To String
Hey,

This'll sound like a weird question, but does anyone know how to make a code that'll remove the last 3 characters from a string?

And then, something even harder, is if the string does NOT end in ".ini" to add ".ini" to the string?

The reasion why I need to know this is because I have an account maker that saves user's files as UsernameEntered.ini So that I only have to enter in the user's name and it'll put the INI for me. The Problem is though when I edit the file, I end up with UsernameEntered.ini.ini which I don't want.

I can likely get along with only the "Remove last 3 characters from string" code fairly well, but the adding letters would also be handy to know.

Hope someone can help me,

and Thanks

Replace Letters In String
Hello everybody!

Beginers question:
I do not know how to make a code where VB6 would automaticaly change the entered letters.

Example:
I have my own special alphabet letters: A=KU, B=DE, C=VE, D=SI
I enter a word into textbox: ABCDE
<then I press the button TRANSFORM>
I get out the result: KUDEVESI

Can you help me?

regards,
Dejan

Can I Split A String Into Letters??
Hi,
I need To Split A String Into Letters, Or To Remove A Specific Letters From String , as An Example :
Have A String 1/2/2005
I Want To save 1 into a variable, 2 into a variable , 2005 into a variable, so is there a way to do that

Remove The First 6 Letters From A String
hi, does anyone know how to remove the first 6 characters from a string?

Checking String For Letters Thanks!
Hi

Does anybody know how i can determine whether or not there are letters in a string? It might be a combo of letters and numbers. How can i tell if there is a letter in the string??

There must be an easier way to do this than to check every single character in the string..

Thanks..

CD Letters, And String Stuffz ;)
I need some help..

code start here:
Dim CD As String, Tmp As String

Tmp="D:[CD Rom Drive]"

Code end here...

How can I put the 2 first character of 'Tmp' in the variable 'CD'?
After this CD need to be equal at "D:"

And a last question: how can I detect the CD Rom Drive's Letter?

Thanx all.

Changing Letters In A String
ok in textbox1 the user types "hello" . in textbox2 the letter "H" will be replaced with "|-|" and the "E" will be replaced with "3", "L" be replaced with " |_" and "O" with "" so it would look like "|-|3|_|_ "

can anyone help me on this?

Single Out Certain Letters In String
Is there a way to single out certain characters in strings of text and make them their own strings?

Trim Letters Of A String
I made my own mp3 player and I am sick and tired of having .mp3 on the end of my songs name. I have a common dialog control that adds the songs to a list box. So is there a way to trim the filetitle of the commondialog control so that it is Metallica - For Whom The Bells Toll instead of Metallica - For Whom The Bells Toll.mp3

Thank you!!

Extrach Letters From A String
I have a string that looks like this

123!ThisLetter!344

I need to get the letter 'ThisLetter' or in other word letter between first! and last!, because the length of the middle letter can change.

Any idea of how to do that.
Thanks.



Only Letters And Numbers In A String
Hello, how do I check if there are only letters and numbers in a string and nothing else?

Thanks.

Stripping Letters From A String
Hi all

Anyone know a quick way to progammatically strip letters and spaces from a string to leave just numbers and punctuation?

e.g. reduce "Item 12. View 2." to "12.2."
another e.g "Item 1234. View 34." to "1234.34."

Trying to do it with Left, Right and Mid is not only messy will be too slow

Any assistance would be appreciated

Regards

Adrian

Finding Out How Many Letters Are In A String.
I need to find out how many letters are in a string so I can use that ammount and subtract it from another string...

For example.

Right(sSubData, Len(sSubData) - (2 + minusnum))

where minusnum will be the number of letters in a string.

any help will be greatly appreciated.

Comparing The Last Letters Of A String
how can i compare the last 3 letters of a string. So I can see what a file extension in a text box is. Would I need to use
the len function?

thnx

Replacing All Letters And Numbers In String?
How would i go about replacing a string like this :

Xtreme_VB_006
to
Xxxxx_XX_###

Pulling Letters From A String Into An Array
i want the user to be able to enter a name into a box :

txtinput.text = "Billy"

then when the user presses a command button it will determain how many characters was inputted by the user and generate an array similar to the following:

inputarray(1) = "B"
Inputarray(2) = "i"
Inputarray(3) = "l"
Inputarray(4) = "l"
Inputarray(5) = "y"

how would i go about this? i immagine some kind of for next loop? but how will i determin the ammount of characters in the string inputted by the user, also how will i actually get the string seperated letter by letter and sent to the array?

Cheers

Pendaz

Letters In An Array --&gt; Put Back Into A String?
I am currently being confronted with this problem from a little assignment for computer science class.


Here's the situation:

The user enters a name (Jane Doe) in a textbox for example,
and the program reverses the last 3 letters of the name so it becomes
"Jane eoD".
You must display the encoded name in a textbox

I am currently using an array, reading in the letters of the name and storing them in an element in the 1-dimensional array.
I can reverse the letters properly,
but I have no clue how to reconstruct the name so it prints in 1 consecutive line in a textbox.

**********************
For intCount = 1 To intLetterAmount
txtOut.Text = strLetters(intCount)
Next intCount
***********************

That only prints out the last letter in the array, which is D (Jane eoD)

THANKS SO MUCH :}

What Is The Fastest Way To Remove All Non Letters From A String?
How can you quickly remove all characters from a string that are not letters?
For example in the string

"katface90@something.com" -> "katfacesomethingcom"

any idea?

RESOLVED: VB6: Random Letters In A String
I'm not sure the title is very clear since I don't really know what to do, sorry in that case.

My problem is to create a code in which there will appear random letters in a label. I also want the number of letters shown to be a varibel.

Hope I am clear enough. I would very much appriciate your help, and please, keep it simple and comment your codes in order for me to understand

Check String For Values Other Than Letters
I have a function that returns a persons name from a database, but I haven't been able to figure out how to get Vb to call it properly. Obviously, I only want to call this function when the string contains a character between the letter "A" and the letter "Z". Upper or lowercase does not matter.

So I guess I'm asking how to code something like


VB Code:
If strValueEntered Contains a character or number Then   Do nothingElse  'If the character is a letter  Call FunctionEnd if

Break Up String Into Separate Letters
I have a number like 100. Can someone write some code that would break up 100 into separate characters? So then the output would be something like:

input:
Code:
100
output:
Code:
1 0 0


Thanks!

How To Change A String To Capital Letters Only?
How to change a strings letters to capital? i knew it but i forgot how can i do that :P

Return True If There Are Letters In A String
How can I tell if there are any letters (a-z, A-Z) in a string of characters?

Thanks

Counting Number Of Letters In String
I'm not sure what the syntax is because I've not been programming VB for very long (in fact I've only been programming since september last year!)

But what I want to do is, allow the User to type in some text (its one word) then for the Program to give an output depending on the number of letters in that word.

I imagine the structure would be something like this,

Command button is pushed, the text in the text box is assigned to a string variable, then I'm not quite sure so I can't start to guess at syntax, and from that the number of characters in that string are converted to an integer. I imagine this is going to involve nested For loops.

from that I can then use the Integer to give the output based on the value of the Integer using If statements (it will only be a 4 - 8 charater word for the most part so that won't take to long. (note the output is not the same as the Integer.)

BSTR And Spaces Between Letters Of A String
Env: Win2K SP1, VB 6 SP4

Hey All,
I am trying to get a sting back in a structure from an API Call to the HTMLHelp lib. I have to pass in a Type which is defined in VB as so:


Type HH_LAST_ERROR
cbStruct as Integer
hr as Long
description as string
End Type




It is defined in a C++ like so:


typedef struct tagHH_LAST_ERROR
{ int cbStruct ;
HRESULT hr ;
BSTR description ;
} HH_LAST_ERROR ;




However when I make my function call and get the value for description, the string has a space between each letter like so:

"S o m e E r r o r . C o n t a c t A d m i n .

When looking at it in the debugger there is a square symbol between each letter. I believe I have somehow done something wrong in declaring my VB Type to represent the C++ structure. Or maybe I have to do some conversion. I am a C++ programmer and new to VB. Any sugguestions would be helpful.

Thanks
Vince

Loop To Create All Possible Words From String Of Letters
I have been racking my brain, and can't come up with the best solution on how to do this. I want to be able to input six letters and create every possible combination of 3, 4, 5, and 6 letter words. Only using each letter once, and then check each combination against a word list to see if any of them are real words.

Does this make any sense? Does anyone have any clue where to point me to get started?

Thanks,
Oabie

Find The Last Letter In A String Containing Letters And Numbers
HI

I am trying to find the last letter within a string.

I have a field which contains data like CV8 7TY0124 121212

I am trying to extract everything prior to the first letter, ie CV8 7TY

I am thinking about finding the last letter within a string, then using the right, left or Mid funtion to grab the characters I want. Am I on the right lines?

Would appreciate any help

Check A String For Any Keys Besides Alphabetic Letters?
Hey, i have an input box where i would like a user to input their name, and this would only be able to contain CAPITAL and lowercase letters....when you click on the command button, it checks the contents of the string to see if it contains any letters other then the alphabet.......i have done this so far, it detects just if its a plain number, but it doesnt if there are letters or other characters in it.....how could i advance this to check the whole string to see if it contains other characters?

this is what i have got so far


VB Code:
If IsNumeric(txtPlayer(Index).Text) Then            MsgBox ("Please ensure that Player " & Index & " has a name set.")            txtPlayer(Index).SetFocus            txtPlayer(Index).SelStart = 0            txtPlayer(Index).SelLength = Len(txtPlayer(Index).Text)            Exit SubEnd If

How Can You Msgbox A Random 6 Character String Of Letters?
followed by a 2digit number?

anyone know?

Removing Letters Form Text String
how can i remove the last 3 letters of a text string ?

Calculate The Value Of String Based On It's Digits And Letters. (Not HEX Values)
I have been banging my head against the wall over this issue for days now. I just can't seem to sort this thing out. Here is my scenario :

I have a variable which contains a random string. The string may or may not look like any of the following examples :

UU
2W
2BB
8
3R
U
6G
0
4
3UU

Basically, this random string will always be constructed of digits 0 thru 9 and letters B,G,R,U and W (in any order). One thing to understand is that the string length has the potential to be made up of a different number of characters every time.

That is my scenario. Now onto my problem. I want to make a calculation utilizing the string data where digits 0 thru 9 are equal to their respected value then add the number of non-digit characters in the string to the value of the sum of the digit characters.

For example :

UU would equal 2
2W would equal 3
2BB would equal 4
8 would equal 8
3R would equal 4
U would equal 1
6G would equal 7
0 would equal 0
4 would equal 4
3UU would equal 5


This perplexing situation has been causing me grief for days. Would somebody (without providing too much code and doing it for me) point me into the correct direction so that I can overcome this miserable problem. I feel that the string must first be split into individual characters after which each character is determined to be either a DIGIT worth its actual numerical value or a letter worth 1. Then a tally calculation can be made from that point. One problem I have is I'm not sure how to use the SPLIT() function to split something without a delimiter. How do you SPLIT "4GGG"?

Thanks for any and ALL assistance into this matter!!
Cheers!!

Extracting Letters From A String And Getting Dates From Calendar Controls
Hi, Im doing an A2 computing project and I am having problems with 2 aspects of my program:

first problem - I need 2 take the first 2 letters from a string so that i can use them to search a database to get information from another table.

second problem - I need to take the date of a monday from a calendar cotrol no matter what day the user picks.

Please help me, cheers
Marcus Tibbitts

Looping Though A String
Hi All,

How can I loop though a string that contains this

"{
tf1ansiansicpg1252deff0deftab720{fonttbl{f0fswiss MS Sans Serif;}{f1fromanfcharset2 Symbol;}{f2fswiss MS Sans Serif;}}
{colortbl
ed0green0lue0;}
deflang2057horzdoc{*fchars }{*lchars }pardplainf2fs24cf0
par
par 500 - 600mm run out length required.
par }
"

and when it gets to the first "par" finish the loop, I would of used the replace function but string could be diffrent, but the "par will always be there.

Thanks

Loftty

Looping Though A String
How can I loop through a string? Something similar to this in C:


Code:
for (int a = 0; a < string.length(); a++) string[a];

Looping Through A String
Hi everyone,
I am having real problems getting my mind wrapped around loop constructs. can someone please provide me with a simple example of going through a string of X length (with X always being different), then just doing something simple like assigning each character to a label or textbox. This is just for me to learn and try to get it straight in my mind, so as many remarks in the code as possible would also help. Also any other links/examples that you may have will be greatly appreciated.
Thanks,
Michael

String Parsing / Looping
Hey, i'm moving into the world of parsing strings etc etc..and file input/output. i'm new to this and for a starter project i chose to do something that would be productive for myself in my line of work. i have large mail logs (2 gigs) that i split into smaller 30 meg files. i took a line out of the logs that repeats and started a project. the text from that line i put in a textbox. i put a command button on the form and another textbox. here is my code:

(the string in the textbox is: Aug 8 08:24:49 scorpion [1401]: Stats:
username 0 0 0 0 my.domain.com x.x.x.x)

Code:
Private Sub Command1_Click()
Dim pos As Integer
Dim pos2 As Integer
Dim final As Integer
Dim test As String
pos = InStr(Text1.Text, "Stats: ")
starttxt = pos + 7
pos2 = InStr(Text1.Text, "0 0 0 0")
endtxt = pos2 - 1
final = endtxt - starttxt
'Label1.Caption = pos2
test = Trim(Mid$(Text1.Text, pos + 7, final)) & vbCrLf
Text2.Text = Text2.Text & test
End Sub
what i've done so far is to pull the username from this string, which works just fine. ultimately i want to get the username/ip address from this and have it send to a textbox or grid. my ordeal is not getting this username from this one string, however what if there are lines of the same format, only with different usernames/ip's. i want to loop through the textbox and pull this same info from the other strings. also, ultimately i would provide a file open instead of using a textbox.
any ideas on this?
thanks.

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