Results for "Category: String Manipulation"
I've had a lot of people ask me how to create "Elite" text or "Funky" looking text, so here it is. The coding is extremely simple and it's commented. No votes unless this really helps you or something!
This is a set of three functions that pull tagged data, such as that from HTML or XML, based on the tag name. I've used this in a number of applications where I've need to store multiple bits of variable-length data in a single string or file.
The purpose of this routine is to take a string of text (such as with a textbox) and extract a numerical value from it. let's say that you have a textbox in which people enter dollar amounts. Many users are likely to enter something such as "$ 4,335.49" and expect calculations to be performed on it. The trouble is, the value of that string is 0 (zero), not 4335.49!
Splits a string in two or more parts so they can fit in a given space, but only take into account complete words.
I hope I'm not the only person who wants to cringe every time I see something like "You have been online for 1 minutes." 1 minutes?? I see this kind of thing everywhere; here on PSC, even. It looks very unprofessional to me, and it's so easy to fix! That's why I listed this code as beginner level. Hopefully, Planet Source Code will implement this code and I won't have to see that I got an excellent vote from "1 users." ;-) I would like to hear any comments you have about this code. Also, please click to see my other submissions to PSC. My latest program, Music Maker is nearing the top of the Code of the Month list. If I can get a few more votes it would really help me out! :-) Thanks for looking!
This example will show you how parse a list a variables quickly with minimal coding.
This is an update to Kurt Joseph Serge's word counter code that was long, clunky and not entirely accurate. Takes a string and counts the "words" (characters separated by spaces) in it. Take a look.
This will generate a unique serial number from your username! This is very handy for protecting your software! The code is fully commented so u can see what the hell is going on :o)
Makes Twisted Text, Kinda Like Scrambled
Convert Columns To Rows for Excel. Select Cells and copy to clipboard. Click then past back to excel.
This function takes a long string of text, splits it up into lines for printing or displaying, then returns the new string. Like the newspaper, it doesnt cut off words, it carries them over to the next line. It includes a function to check for the longest word so you dont accidently ask for a column width smaller than your largest word.
If you ever wanted to have a string with quotes inside this is a handy tip.
Here is an example of how one can count the number of appearances of a specified character in a given textstring. Included is a little project file with a form. The code is quite understandable. Actually it is beginners code. I just submitted this as a sequel to another submission here on PSC. Not that I find the other submission bad, but to show another way of doing things.
This code will cycle through a text box or rich text box line by line, select the line and place it into a string array. The array will then be passed to another method where it will be placed into a list box excluding the blank lines. I've seen other code like this but if there is no ending vbCrLf then the last line of the box is not read, I've fixed this and showed how to extract the line information and how to use it. The code is slowed down using a pause routine that I made about a year ago.
Drag and Drop a Free File onto the List Box. The Application opens the File as Binary and loads it into Buffer Space and scans the contents for Virus Strings. Very easy to do, and commented. It only does a single file right now, looking to add Directories upcoming.
VB forgot to add a Function strip out all those LEADING, TRAILING and EXTRA spaces in ONE Function. I have seen many attempts at doing this but think mine does it in the least amount of code. Note: = literal SPACE
Takes a number and returns a word expression for that number. Example: 123.01 returns "One Hundred Twenty-three And 01/100". Very useful for printing checks.
A sample VB program that demonstrates how to find and select words in a Textbox. Very simple but quite useful! Please rate!
Actually this is kind of fun. This program genaerates 1000000 completely random letters and then uses the microsoft Word Spell check object to look for real words. You can specify the minimum length of text to search for as well as maximum and it will highlight real words. i put an Algorythm that looks for words based on each character position, for example, if "WHOLE" is found it will return 3 words, "Whole", Hole", and OLE". You would be surprised to see some of the words that are generated. Oh well, good for a dyno test on your computer at least. Comments and votes are greatly appreciated.
Compresses strings, most effective on bitmap files